com.sun.tools.internal.xjc.model.Model Java Examples

The following examples show how to use com.sun.tools.internal.xjc.model.Model. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BGMBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Entry point.
 */
public static Model build( XSSchemaSet _schemas, JCodeModel codeModel,
        ErrorReceiver _errorReceiver, Options opts ) {
    // set up a ring
    final Ring old = Ring.begin();
    try {
        ErrorReceiverFilter ef = new ErrorReceiverFilter(_errorReceiver);

        Ring.add(XSSchemaSet.class,_schemas);
        Ring.add(codeModel);
        Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
        Ring.add(model);
        Ring.add(ErrorReceiver.class,ef);
        Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));

        BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
            opts.isExtensionMode(),opts.getFieldRendererFactory(), opts.activePlugins);
        builder._build();

        if(ef.hadError())   return null;
        else                return model;
    } finally {
        Ring.end(old);
    }
}
 
Example #2
Source File: RELAXNGCompiler.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public RELAXNGCompiler(DPattern grammar, JCodeModel codeModel, Options opts) {
    this.grammar = grammar;
    this.opts = opts;
    this.model = new Model(opts,codeModel, NameConverter.smart,opts.classNameAllocator,null);

    datatypes.put("",DatatypeLib.BUILTIN);
    datatypes.put(WellKnownNamespaces.XML_SCHEMA_DATATYPES,DatatypeLib.XMLSCHEMA);

    // find all defines
    DefineFinder deff = new DefineFinder();
    grammar.accept(deff);
    this.defs = deff.defs;

    if(opts.defaultPackage2!=null)
        pkg = codeModel._package(opts.defaultPackage2);
    else
    if(opts.defaultPackage!=null)
        pkg = codeModel._package(opts.defaultPackage);
    else
        pkg = codeModel.rootPackage();
}
 
Example #3
Source File: RELAXNGCompiler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public RELAXNGCompiler(DPattern grammar, JCodeModel codeModel, Options opts) {
    this.grammar = grammar;
    this.opts = opts;
    this.model = new Model(opts,codeModel, NameConverter.smart,opts.classNameAllocator,null);

    datatypes.put("",DatatypeLib.BUILTIN);
    datatypes.put(WellKnownNamespaces.XML_SCHEMA_DATATYPES,DatatypeLib.XMLSCHEMA);

    // find all defines
    DefineFinder deff = new DefineFinder();
    grammar.accept(deff);
    this.defs = deff.defs;

    if(opts.defaultPackage2!=null)
        pkg = codeModel._package(opts.defaultPackage2);
    else
    if(opts.defaultPackage!=null)
        pkg = codeModel._package(opts.defaultPackage);
    else
        pkg = codeModel.rootPackage();
}
 
Example #4
Source File: RawTypeSetBuilder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The whole type set can be later bound to a reference property,
 * in which case we need to generate additional code to wrap this
 * type reference into an element class.
 *
 * This method generates such an element class and returns it.
 */
protected void toElementRef(CReferencePropertyInfo prop) {
    CClassInfo scope = Ring.get(ClassSelector.class).getCurrentBean();
    Model model = Ring.get(Model.class);

    CCustomizations custs = Ring.get(BGMBuilder.class).getBindInfo(decl).toCustomizationList();

    if(target instanceof CClassInfo && Ring.get(BIGlobalBinding.class).isSimpleMode()) {
        CClassInfo bean = new CClassInfo(model,scope,
                        model.getNameConverter().toClassName(decl.getName()),
                        decl.getLocator(), null, BGMBuilder.getName(decl), decl,
                        custs);
        bean.setBaseClass((CClassInfo)target);
        prop.getElements().add(bean);
    } else {
        CElementInfo e = new CElementInfo(model,BGMBuilder.getName(decl),scope,target,
                decl.getDefaultValue(), decl, custs, decl.getLocator());
        prop.getElements().add(e);
    }
}
 
Example #5
Source File: BGMBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Entry point.
 */
public static Model build( XSSchemaSet _schemas, JCodeModel codeModel,
        ErrorReceiver _errorReceiver, Options opts ) {
    // set up a ring
    final Ring old = Ring.begin();
    try {
        ErrorReceiverFilter ef = new ErrorReceiverFilter(_errorReceiver);

        Ring.add(XSSchemaSet.class,_schemas);
        Ring.add(codeModel);
        Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
        Ring.add(model);
        Ring.add(ErrorReceiver.class,ef);
        Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));

        BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
            opts.isExtensionMode(),opts.getFieldRendererFactory(), opts.activePlugins);
        builder._build();

        if(ef.hadError())   return null;
        else                return model;
    } finally {
        Ring.end(old);
    }
}
 
Example #6
Source File: RELAXNGCompiler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public RELAXNGCompiler(DPattern grammar, JCodeModel codeModel, Options opts) {
    this.grammar = grammar;
    this.opts = opts;
    this.model = new Model(opts,codeModel, NameConverter.smart,opts.classNameAllocator,null);

    datatypes.put("",DatatypeLib.BUILTIN);
    datatypes.put(WellKnownNamespaces.XML_SCHEMA_DATATYPES,DatatypeLib.XMLSCHEMA);

    // find all defines
    DefineFinder deff = new DefineFinder();
    grammar.accept(deff);
    this.defs = deff.defs;

    if(opts.defaultPackage2!=null)
        pkg = codeModel._package(opts.defaultPackage2);
    else
    if(opts.defaultPackage!=null)
        pkg = codeModel._package(opts.defaultPackage);
    else
        pkg = codeModel.rootPackage();
}
 
Example #7
Source File: BGMBuilder.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Entry point.
 */
public static Model build( XSSchemaSet _schemas, JCodeModel codeModel,
        ErrorReceiver _errorReceiver, Options opts ) {
    // set up a ring
    final Ring old = Ring.begin();
    try {
        ErrorReceiverFilter ef = new ErrorReceiverFilter(_errorReceiver);

        Ring.add(XSSchemaSet.class,_schemas);
        Ring.add(codeModel);
        Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
        Ring.add(model);
        Ring.add(ErrorReceiver.class,ef);
        Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));

        BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
            opts.isExtensionMode(),opts.getFieldRendererFactory(), opts.activePlugins);
        builder._build();

        if(ef.hadError())   return null;
        else                return model;
    } finally {
        Ring.end(old);
    }
}
 
Example #8
Source File: RawTypeSetBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The whole type set can be later bound to a reference property,
 * in which case we need to generate additional code to wrap this
 * type reference into an element class.
 *
 * This method generates such an element class and returns it.
 */
protected void toElementRef(CReferencePropertyInfo prop) {
    CClassInfo scope = Ring.get(ClassSelector.class).getCurrentBean();
    Model model = Ring.get(Model.class);

    CCustomizations custs = Ring.get(BGMBuilder.class).getBindInfo(decl).toCustomizationList();

    if(target instanceof CClassInfo && Ring.get(BIGlobalBinding.class).isSimpleMode()) {
        CClassInfo bean = new CClassInfo(model,scope,
                        model.getNameConverter().toClassName(decl.getName()),
                        decl.getLocator(), null, BGMBuilder.getName(decl), decl,
                        custs);
        bean.setBaseClass((CClassInfo)target);
        prop.getElements().add(bean);
    } else {
        CElementInfo e = new CElementInfo(model,BGMBuilder.getName(decl),scope,target,
                decl.getDefaultValue(), decl, custs, decl.getLocator());
        prop.getElements().add(e);
    }
}
 
Example #9
Source File: BGMBuilder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Entry point.
 */
public static Model build( XSSchemaSet _schemas, JCodeModel codeModel,
        ErrorReceiver _errorReceiver, Options opts ) {
    // set up a ring
    final Ring old = Ring.begin();
    try {
        ErrorReceiverFilter ef = new ErrorReceiverFilter(_errorReceiver);

        Ring.add(XSSchemaSet.class,_schemas);
        Ring.add(codeModel);
        Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
        Ring.add(model);
        Ring.add(ErrorReceiver.class,ef);
        Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));

        BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
            opts.isExtensionMode(),opts.getFieldRendererFactory(), opts.activePlugins);
        builder._build();

        if(ef.hadError())   return null;
        else                return model;
    } finally {
        Ring.end(old);
    }
}
 
Example #10
Source File: RawTypeSetBuilder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The whole type set can be later bound to a reference property,
 * in which case we need to generate additional code to wrap this
 * type reference into an element class.
 *
 * This method generates such an element class and returns it.
 */
protected void toElementRef(CReferencePropertyInfo prop) {
    CClassInfo scope = Ring.get(ClassSelector.class).getCurrentBean();
    Model model = Ring.get(Model.class);

    CCustomizations custs = Ring.get(BGMBuilder.class).getBindInfo(decl).toCustomizationList();

    if(target instanceof CClassInfo && Ring.get(BIGlobalBinding.class).isSimpleMode()) {
        CClassInfo bean = new CClassInfo(model,scope,
                        model.getNameConverter().toClassName(decl.getName()),
                        decl.getLocator(), null, BGMBuilder.getName(decl), decl,
                        custs);
        bean.setBaseClass((CClassInfo)target);
        prop.getElements().add(bean);
    } else {
        CElementInfo e = new CElementInfo(model,BGMBuilder.getName(decl),scope,target,
                decl.getDefaultValue(), decl, custs, decl.getLocator());
        prop.getElements().add(e);
    }
}
 
Example #11
Source File: RELAXNGCompiler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public RELAXNGCompiler(DPattern grammar, JCodeModel codeModel, Options opts) {
    this.grammar = grammar;
    this.opts = opts;
    this.model = new Model(opts,codeModel, NameConverter.smart,opts.classNameAllocator,null);

    datatypes.put("",DatatypeLib.BUILTIN);
    datatypes.put(WellKnownNamespaces.XML_SCHEMA_DATATYPES,DatatypeLib.XMLSCHEMA);

    // find all defines
    DefineFinder deff = new DefineFinder();
    grammar.accept(deff);
    this.defs = deff.defs;

    if(opts.defaultPackage2!=null)
        pkg = codeModel._package(opts.defaultPackage2);
    else
    if(opts.defaultPackage!=null)
        pkg = codeModel._package(opts.defaultPackage);
    else
        pkg = codeModel.rootPackage();
}
 
Example #12
Source File: BGMBuilder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Entry point.
 */
public static Model build( XSSchemaSet _schemas, JCodeModel codeModel,
        ErrorReceiver _errorReceiver, Options opts ) {
    // set up a ring
    final Ring old = Ring.begin();
    try {
        ErrorReceiverFilter ef = new ErrorReceiverFilter(_errorReceiver);

        Ring.add(XSSchemaSet.class,_schemas);
        Ring.add(codeModel);
        Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
        Ring.add(model);
        Ring.add(ErrorReceiver.class,ef);
        Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));

        BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
            opts.isExtensionMode(),opts.getFieldRendererFactory(), opts.activePlugins);
        builder._build();

        if(ef.hadError())   return null;
        else                return model;
    } finally {
        Ring.end(old);
    }
}
 
Example #13
Source File: RawTypeSetBuilder.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The whole type set can be later bound to a reference property,
 * in which case we need to generate additional code to wrap this
 * type reference into an element class.
 *
 * This method generates such an element class and returns it.
 */
protected void toElementRef(CReferencePropertyInfo prop) {
    CClassInfo scope = Ring.get(ClassSelector.class).getCurrentBean();
    Model model = Ring.get(Model.class);

    CCustomizations custs = Ring.get(BGMBuilder.class).getBindInfo(decl).toCustomizationList();

    if(target instanceof CClassInfo && Ring.get(BIGlobalBinding.class).isSimpleMode()) {
        CClassInfo bean = new CClassInfo(model,scope,
                        model.getNameConverter().toClassName(decl.getName()),
                        decl.getLocator(), null, BGMBuilder.getName(decl), decl,
                        custs);
        bean.setBaseClass((CClassInfo)target);
        prop.getElements().add(bean);
    } else {
        CElementInfo e = new CElementInfo(model,BGMBuilder.getName(decl),scope,target,
                decl.getDefaultValue(), decl, custs, decl.getLocator());
        prop.getElements().add(e);
    }
}
 
Example #14
Source File: PackageOutlineImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected PackageOutlineImpl( BeanGenerator outline, Model model, JPackage _pkg ) {
    this._model = model;
    this._package = _pkg;
    switch(model.strategy) {
    case BEAN_ONLY:
        objectFactoryGenerator = new PublicObjectFactoryGenerator(outline,model,_pkg);
        break;
    case INTF_AND_IMPL:
        objectFactoryGenerator = new DualObjectFactoryGenerator(outline,model,_pkg);
        break;
    default:
        throw new IllegalStateException();
    }
}
 
Example #15
Source File: DualObjectFactoryGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
DualObjectFactoryGenerator(BeanGenerator outline, Model model, JPackage targetPackage) {
    this.publicOFG = new PublicObjectFactoryGenerator(outline,model,targetPackage);
    this.privateOFG = new PrivateObjectFactoryGenerator(outline,model,targetPackage);

    // put the marker so that we can detect missing jaxb.properties
    publicOFG.getObjectFactory().field(JMod.PRIVATE|JMod.STATIC|JMod.FINAL,
            Void.class, "_useJAXBProperties", JExpr._null());
}
 
Example #16
Source File: ModelLoader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Common part between the XML syntax and the compact syntax.
 */
private Model loadRELAXNG(Parseable p) {
    SchemaBuilder sb = new CheckingSchemaBuilder(new DSchemaBuilderImpl(),errorReceiver);

    try {
        DPattern out = (DPattern)p.parse(sb);
        return RELAXNGCompiler.build(out,codeModel,opt);
    } catch (IllegalSchemaException e) {
        errorReceiver.error(e.getMessage(),e);
        return null;
    }
}
 
Example #17
Source File: ModelLoader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a RELAX NG grammar into an annotated grammar.
 */
private Model loadRELAXNG() throws SAXException {

    // build DOM forest
    final DOMForest forest = buildDOMForest( new RELAXNGInternalizationLogic() );

    // use JAXP masquerading to validate the input document.
    // DOMForest -> ExtensionBindingChecker -> RNGOM

    XMLReaderCreator xrc = new XMLReaderCreator() {
        public XMLReader createXMLReader() {

            // foreset parser cannot change the receivers while it's working,
            // so we need to have one XMLFilter that works as a buffer
            XMLFilter buffer = new XMLFilterImpl() {
                @Override
                public void parse(InputSource source) throws IOException, SAXException {
                    forest.createParser().parse( source, this, this, this );
                }
            };

            XMLFilter f = new ExtensionBindingChecker(Const.RELAXNG_URI,opt,errorReceiver);
            f.setParent(buffer);

            f.setEntityResolver(opt.entityResolver);

            return f;
        }
    };

    Parseable p = new SAXParseable( opt.getGrammars()[0], errorReceiver, xrc );

    return loadRELAXNG(p);

}
 
Example #18
Source File: CollectionTypeAttribute.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private FieldRenderer calcFr(Model m) {
    FieldRendererFactory frf = m.options.getFieldRendererFactory();
    if (collectionType==null)
        return frf.getDefault();

    if (collectionType.equals("indexed"))
        return frf.getArray();

    return frf.getList(m.codeModel.ref(collectionType));
}
 
Example #19
Source File: PrivateObjectFactoryGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public PrivateObjectFactoryGenerator(BeanGenerator outline, Model model, JPackage targetPackage) {
    super(outline, model, targetPackage.subPackage("impl"));

    JPackage implPkg = targetPackage.subPackage("impl");

    // put JAXBContextFactory into the impl package
    JClass factory = outline.generateStaticClass(JAXBContextFactory.class,implPkg);

    // and then put jaxb.properties to point to it
    JPropertyFile jaxbProperties = new JPropertyFile("jaxb.properties");
    targetPackage.addResourceFile(jaxbProperties);
    jaxbProperties.add(
        JAXBContext.JAXB_CONTEXT_FACTORY,
        factory.fullName());
}
 
Example #20
Source File: PrivateObjectFactoryGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public PrivateObjectFactoryGenerator(BeanGenerator outline, Model model, JPackage targetPackage) {
    super(outline, model, targetPackage.subPackage("impl"));

    JPackage implPkg = targetPackage.subPackage("impl");

    // put JAXBContextFactory into the impl package
    JClass factory = outline.generateStaticClass(JAXBContextFactory.class,implPkg);

    // and then put jaxb.properties to point to it
    JPropertyFile jaxbProperties = new JPropertyFile("jaxb.properties");
    targetPackage.addResourceFile(jaxbProperties);
    jaxbProperties.add(
        JAXBContext.JAXB_CONTEXT_FACTORY,
        factory.fullName());
}
 
Example #21
Source File: DualObjectFactoryGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
DualObjectFactoryGenerator(BeanGenerator outline, Model model, JPackage targetPackage) {
    this.publicOFG = new PublicObjectFactoryGenerator(outline,model,targetPackage);
    this.privateOFG = new PrivateObjectFactoryGenerator(outline,model,targetPackage);

    // put the marker so that we can detect missing jaxb.properties
    publicOFG.getObjectFactory().field(JMod.PRIVATE|JMod.STATIC|JMod.FINAL,
            Void.class, "_useJAXBProperties", JExpr._null());
}
 
Example #22
Source File: BIEnumeration.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static List<CEnumConstant> buildMemberList( Model model, Element dom ) {
    List<CEnumConstant> r = new ArrayList<CEnumConstant>();

    String members = DOMUtil.getAttribute(dom,"members");
    if(members==null) members="";   // TODO: error handling

    StringTokenizer tokens = new StringTokenizer(members);
    while(tokens.hasMoreTokens()) {
        String token = tokens.nextToken();
        r.add(new CEnumConstant(model.getNameConverter().toConstantName(token),
                null,token,null/*TODO*/,null,null));
    }

    return r;
}
 
Example #23
Source File: DualObjectFactoryGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
DualObjectFactoryGenerator(BeanGenerator outline, Model model, JPackage targetPackage) {
    this.publicOFG = new PublicObjectFactoryGenerator(outline,model,targetPackage);
    this.privateOFG = new PrivateObjectFactoryGenerator(outline,model,targetPackage);

    // put the marker so that we can detect missing jaxb.properties
    publicOFG.getObjectFactory().field(JMod.PRIVATE|JMod.STATIC|JMod.FINAL,
            Void.class, "_useJAXBProperties", JExpr._null());
}
 
Example #24
Source File: ModelLoader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a DTD file into an annotated grammar.
 *
 * @param   source
 *      DTD file
 * @param   bindFile
 *      External binding file.
 */
private Model loadDTD( InputSource source, InputSource bindFile) {

    // parse the schema as a DTD.
    return TDTDReader.parse(
        source,
        bindFile,
        errorReceiver,
        opt);
}
 
Example #25
Source File: ModelLoader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Common part between the XML syntax and the compact syntax.
 */
private Model loadRELAXNG(Parseable p) {
    SchemaBuilder sb = new CheckingSchemaBuilder(new DSchemaBuilderImpl(),errorReceiver);

    try {
        DPattern out = (DPattern)p.parse(sb);
        return RELAXNGCompiler.build(out,codeModel,opt);
    } catch (IllegalSchemaException e) {
        errorReceiver.error(e.getMessage(),e);
        return null;
    }
}
 
Example #26
Source File: ModelLoader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Loads RELAX NG compact syntax
 */
private Model loadRELAXNGCompact() {
    if(opt.getBindFiles().length>0)
        errorReceiver.error(new SAXParseException(
            Messages.format(Messages.ERR_BINDING_FILE_NOT_SUPPORTED_FOR_RNC),null));

    // TODO: entity resolver?
    Parseable p = new CompactParseable( opt.getGrammars()[0], errorReceiver );

    return loadRELAXNG(p);

}
 
Example #27
Source File: ObjectFactoryGeneratorImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public ObjectFactoryGeneratorImpl( BeanGenerator outline, Model model, JPackage targetPackage ) {
    this.outline = outline;
    this.model = model;
    this.codeModel = this.model.codeModel;
    this.classRef = codeModel.ref(Class.class);

    // create the ObjectFactory class skeleton
    objectFactory = this.outline.getClassFactory().createClass(
            targetPackage, "ObjectFactory", null );
    objectFactory.annotate2(XmlRegistryWriter.class);

    // generate the default constructor
    //
    // m1 result:
    //        public ObjectFactory() {}
    JMethod m1 = objectFactory.constructor(JMod.PUBLIC);
    m1.javadoc().append("Create a new ObjectFactory that can be used to " +
                     "create new instances of schema derived classes " +
                     "for package: " + targetPackage.name());

    // add some class javadoc
    objectFactory.javadoc().append(
        "This object contains factory methods for each \n" +
        "Java content interface and Java element interface \n" +
        "generated in the " + targetPackage.name() + " package. \n" +
        "<p>An ObjectFactory allows you to programatically \n" +
        "construct new instances of the Java representation \n" +
        "for XML content. The Java representation of XML \n" +
        "content can consist of schema derived interfaces \n" +
        "and classes representing the binding of schema \n" +
        "type definitions, element declarations and model \n" +
        "groups.  Factory methods for each of these are \n" +
        "provided in this class." );

}
 
Example #28
Source File: ObjectFactoryGeneratorImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public ObjectFactoryGeneratorImpl( BeanGenerator outline, Model model, JPackage targetPackage ) {
    this.outline = outline;
    this.model = model;
    this.codeModel = this.model.codeModel;
    this.classRef = codeModel.ref(Class.class);

    // create the ObjectFactory class skeleton
    objectFactory = this.outline.getClassFactory().createClass(
            targetPackage, "ObjectFactory", null );
    objectFactory.annotate2(XmlRegistryWriter.class);

    // generate the default constructor
    //
    // m1 result:
    //        public ObjectFactory() {}
    JMethod m1 = objectFactory.constructor(JMod.PUBLIC);
    m1.javadoc().append("Create a new ObjectFactory that can be used to " +
                     "create new instances of schema derived classes " +
                     "for package: " + targetPackage.name());

    // add some class javadoc
    objectFactory.javadoc().append(
        "This object contains factory methods for each \n" +
        "Java content interface and Java element interface \n" +
        "generated in the " + targetPackage.name() + " package. \n" +
        "<p>An ObjectFactory allows you to programatically \n" +
        "construct new instances of the Java representation \n" +
        "for XML content. The Java representation of XML \n" +
        "content can consist of schema derived interfaces \n" +
        "and classes representing the binding of schema \n" +
        "type definitions, element declarations and model \n" +
        "groups.  Factory methods for each of these are \n" +
        "provided in this class." );

}
 
Example #29
Source File: BIEnumeration.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static List<CEnumConstant> buildMemberList( Model model, Element dom ) {
    List<CEnumConstant> r = new ArrayList<CEnumConstant>();

    String members = DOMUtil.getAttribute(dom,"members");
    if(members==null) members="";   // TODO: error handling

    StringTokenizer tokens = new StringTokenizer(members);
    while(tokens.hasMoreTokens()) {
        String token = tokens.nextToken();
        r.add(new CEnumConstant(model.getNameConverter().toConstantName(token),
                null,token,null/*TODO*/,null,null));
    }

    return r;
}
 
Example #30
Source File: BIGlobalBinding.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void onSetOwner() {
    super.onSetOwner();
    // if one is given by options, use that
    NameConverter nc = Ring.get(Model.class).options.getNameConverter();
    if(nc!=null)
        nameConverter = nc;
}