コード例 #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;
  }
コード例 #2
0
  private CCustomizations getCustomizations(XSParticle src) {
    // customizations for a particle  should include those defined in the term unless it's global
    // this is so that the schema like:
    //
    // <xs:sequence>
    //   <xs:element name="foo" type="xs:int">
    //     <xs:annotation><xs:appinfo>
    //       <hyperjaxb:... />
    //
    // would be picked up
    if (src.getTerm().isElementDecl()) {
      XSElementDecl xed = src.getTerm().asElementDecl();
      if (xed.isGlobal()) return getCustomizations((XSComponent) src);
    }

    return getCustomizations(src, src.getTerm());
  }
コード例 #3
0
ファイル: BGMBuilder.java プロジェクト: JSitesh/ikvm-openjdk
  /** Gets the {@link BIDom} object that applies to the given particle. */
  protected final BIDom getLocalDomCustomization(XSParticle p) {
    if (p == null) {
      return null;
    }
    BIDom dom = getBindInfo(p).get(BIDom.class);
    if (dom != null) return dom;

    // if not, the term might have one.
    dom = getBindInfo(p.getTerm()).get(BIDom.class);
    if (dom != null) return dom;

    XSTerm t = p.getTerm();
    // type could also have one, in case of the dom customization
    if (t.isElementDecl()) return getBindInfo(t.asElementDecl().getType()).get(BIDom.class);
    // similarly the model group in a model group definition may have one.
    if (t.isModelGroupDecl())
      return getBindInfo(t.asModelGroupDecl().getModelGroup()).get(BIDom.class);

    return null;
  }
コード例 #4
0
 public XSComponent particle(XSParticle particle) {
   return particle.getTerm(); // inherit from the term
 }