예제 #1
0
  /**
   * If true, the property will automatically be a reference property. (Talk about confusing names!)
   */
  private Boolean generateElementProperty() {
    if (generateElementProperty != null) return generateElementProperty;
    BIProperty next = getDefault();
    if (next != null) return next.generateElementProperty();

    return null;
  }
예제 #2
0
  public void markAsAcknowledged() {
    if (isAcknowledged()) return;

    // mark the parent as well.
    super.markAsAcknowledged();

    BIProperty def = getDefault();
    if (def != null) def.markAsAcknowledged();
  }
예제 #3
0
 // can be null
 public JType getBaseType() {
   if (baseType != null && baseType.name != null) {
     return TypeUtil.getType(
         getCodeModel(), baseType.name, Ring.get(ErrorReceiver.class), getLocation());
   }
   BIProperty next = getDefault();
   if (next != null) return next.getBaseType();
   else return null;
 }
예제 #4
0
  /**
   * Gets the inherited value of the "fixedAttrToConstantProperty" customization.
   *
   * <p>Note that returning true from this method doesn't necessarily mean that a property needs to
   * be mapped to a constant property. It just means that it's mapped to a constant property <b>if
   * an attribute use carries a fixed value.</b>
   *
   * <p>I don't like this semantics but that's what the spec implies.
   */
  public boolean isConstantProperty() {
    if (isConstantProperty != null) return isConstantProperty;

    BIProperty next = getDefault();
    if (next != null) return next.isConstantProperty();

    // globalBinding always has true or false in this property,
    // so this can't happen
    throw new AssertionError();
  }
예제 #5
0
  /**
   * Returns the customized property name.
   *
   * <p>This method honors the "enableJavaNamingConvention" customization and formats the property
   * name accordingly if necessary.
   *
   * <p>Thus the caller should <em>NOT</em> apply the XML-to-Java name conversion algorithm to the
   * value returned from this method.
   *
   * @param forConstant If the property name is intended for a constant property name, set to true.
   *     This will change the result
   * @return This method can return null if the customization doesn't specify the name.
   */
  public String getPropertyName(boolean forConstant) {
    if (name != null) {
      BIGlobalBinding gb = getBuilder().getGlobalBinding();
      NameConverter nc = getBuilder().model.getNameConverter();

      if (gb.isJavaNamingConventionEnabled() && !forConstant)
        // apply XML->Java conversion
        return nc.toPropertyName(name);
      else return name; // ... or don't change the value
    }
    BIProperty next = getDefault();
    if (next != null) return next.getPropertyName(forConstant);
    else return null;
  }
  public void setParent(BindInfo parent) {
    super.setParent(parent);
    // fill in the remaining default values
    if (enumBaseTypes == null)
      enumBaseTypes = Collections.singleton(new QName(WellKnownNamespace.XML_SCHEMA, "string"));

    this.defaultProperty =
        new BIProperty(
            getLocation(),
            null,
            null,
            null,
            collectionType,
            fixedAttributeAsConstantProperty,
            optionalProperty,
            generateElementProperty);
    defaultProperty.setParent(parent); // don't forget to initialize the defaultProperty
  }