示例#1
0
  /**
   * @param defaultName If the name is not customized, this name will be used as the default. Note
   *     that the name conversion <b>MUST</b> be applied before this method is called if necessary.
   * @param source Source schema component from which a field is built.
   */
  public CElementPropertyInfo createElementProperty(
      String defaultName, boolean forConstant, XSParticle source, RawTypeSet types) {

    if (!types.refs.isEmpty())
      // if this property is empty, don't acknowleedge the customization
      // this allows pointless property customization to be reported as an error
      markAsAcknowledged();
    constantPropertyErrorCheck();

    String name = getPropertyName(forConstant);
    if (name == null) name = defaultName;

    CElementPropertyInfo prop =
        wrapUp(
            new CElementPropertyInfo(
                name,
                types.getCollectionMode(),
                types.id(),
                types.getExpectedMimeType(),
                source,
                getCustomizations(source),
                source.getLocator(),
                types.isRequired()),
            source);

    types.addTo(prop);

    BIInlineBinaryData.handle(source.getTerm(), prop);
    return prop;
  }