com.sun.tools.internal.xjc.Options Java Examples
The following examples show how to use
com.sun.tools.internal.xjc.Options.
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: PluginImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public boolean run(Outline model, Options opt, ErrorHandler errorHandler) { for( ClassOutline co : model.getClasses() ) { CPluginCustomization c = co.target.getCustomizations().find(Const.NS,"code"); if(c==null) continue; // no customization --- nothing to inject here c.markAsAcknowledged(); // TODO: ideally you should validate this DOM element to make sure // that there's no typo/etc. JAXP 1.3 can do this very easily. String codeFragment = DOMUtils.getElementText(c.element); // inject the specified code fragment into the implementation class. co.implClass.direct(codeFragment); } return true; }
Example #2
Source File: SourceLocationAddOn.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public boolean run( Outline outline, Options opt, ErrorHandler errorHandler ) { for( ClassOutline ci : outline.getClasses() ) { JDefinedClass impl = ci.implClass; if (ci.getSuperClass() == null) { JVar $loc = impl.field(JMod.PROTECTED, Locator.class, fieldName); $loc.annotate(XmlLocation.class); $loc.annotate(XmlTransient.class); impl._implements(Locatable.class); impl.method(JMod.PUBLIC, Locator.class, "sourceLocation").body()._return($loc); JMethod setter = impl.method(JMod.PUBLIC, Void.TYPE, "setSourceLocation"); JVar $newLoc = setter.param(Locator.class, "newLocator"); setter.body().assign($loc, $newLoc); } } return true; }
Example #3
Source File: Model.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * @param nc * Usually this should be set in the constructor, but we do allow this parameter * to be initially null, and then set later. * @param schemaComponent * The source schema model, if this is built from XSD. */ public Model( Options opts, JCodeModel cm, NameConverter nc, ClassNameAllocator allocator, XSSchemaSet schemaComponent ) { this.options = opts; this.codeModel = cm; this.nameConverter = nc; this.defaultSymbolSpace = new SymbolSpace(codeModel); defaultSymbolSpace.setType(codeModel.ref(Object.class)); elementMappings.put(null,new HashMap<QName,CElementInfo>()); if(opts.automaticNameConflictResolution) allocator = new AutoClassNameAllocator(allocator); this.allocator = new ClassNameAllocatorWrapper(allocator); this.schemaComponent = schemaComponent; this.gloablCustomizations.setParent(this,this); }
Example #4
Source File: PluginImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public boolean run(Outline model, Options opt, ErrorHandler errorHandler) { for( ClassOutline co : model.getClasses() ) { CPluginCustomization c = co.target.getCustomizations().find(Const.NS,"code"); if(c==null) continue; // no customization --- nothing to inject here c.markAsAcknowledged(); // TODO: ideally you should validate this DOM element to make sure // that there's no typo/etc. JAXP 1.3 can do this very easily. String codeFragment = DOMUtils.getElementText(c.element); // inject the specified code fragment into the implementation class. co.implClass.direct(codeFragment); } return true; }
Example #5
Source File: BGMBuilder.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * 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: SourceLocationAddOn.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public boolean run( Outline outline, Options opt, ErrorHandler errorHandler ) { for( ClassOutline ci : outline.getClasses() ) { JDefinedClass impl = ci.implClass; if (ci.getSuperClass() == null) { JVar $loc = impl.field(JMod.PROTECTED, Locator.class, fieldName); $loc.annotate(XmlLocation.class); $loc.annotate(XmlTransient.class); impl._implements(Locatable.class); impl.method(JMod.PUBLIC, Locator.class, "sourceLocation").body()._return($loc); JMethod setter = impl.method(JMod.PUBLIC, Void.TYPE, "setSourceLocation"); JVar $newLoc = setter.param(Locator.class, "newLocator"); setter.body().assign($loc, $newLoc); } } return true; }
Example #7
Source File: Model.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * @param nc * Usually this should be set in the constructor, but we do allow this parameter * to be initially null, and then set later. * @param schemaComponent * The source schema model, if this is built from XSD. */ public Model( Options opts, JCodeModel cm, NameConverter nc, ClassNameAllocator allocator, XSSchemaSet schemaComponent ) { this.options = opts; this.codeModel = cm; this.nameConverter = nc; this.defaultSymbolSpace = new SymbolSpace(codeModel); defaultSymbolSpace.setType(codeModel.ref(Object.class)); elementMappings.put(null,new HashMap<QName,CElementInfo>()); if(opts.automaticNameConflictResolution) allocator = new AutoClassNameAllocator(allocator); this.allocator = new ClassNameAllocatorWrapper(allocator); this.schemaComponent = schemaComponent; this.gloablCustomizations.setParent(this,this); }
Example #8
Source File: DOMForest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Parses an XML at the given location ( * and XMLs referenced by it) into DOM trees * and stores them to this forest. * * @return the parsed DOM document object. */ public Document parse( String systemId, boolean root ) throws SAXException, IOException { systemId = Options.normalizeSystemId(systemId); if( core.containsKey(systemId) ) // this document has already been parsed. Just ignore. return core.get(systemId); InputSource is=null; // allow entity resolver to find the actual byte stream. if( entityResolver!=null ) is = entityResolver.resolveEntity(null,systemId); if( is==null ) is = new InputSource(systemId); // but we still use the original system Id as the key. return parse( systemId, is, root ); }
Example #9
Source File: BGMBuilder.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * 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: BGMBuilder.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * 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 #11
Source File: RELAXNGCompiler.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
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: SourceLocationAddOn.java From hottub with GNU General Public License v2.0 | 6 votes |
public boolean run( Outline outline, Options opt, ErrorHandler errorHandler ) { for( ClassOutline ci : outline.getClasses() ) { JDefinedClass impl = ci.implClass; if (ci.getSuperClass() == null) { JVar $loc = impl.field(JMod.PROTECTED, Locator.class, fieldName); $loc.annotate(XmlLocation.class); $loc.annotate(XmlTransient.class); impl._implements(Locatable.class); impl.method(JMod.PUBLIC, Locator.class, "sourceLocation").body()._return($loc); JMethod setter = impl.method(JMod.PUBLIC, Void.TYPE, "setSourceLocation"); JVar $newLoc = setter.param(Locator.class, "newLocator"); setter.body().assign($loc, $newLoc); } } return true; }
Example #13
Source File: DOMForest.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Parses an XML at the given location ( * and XMLs referenced by it) into DOM trees * and stores them to this forest. * * @return the parsed DOM document object. */ public Document parse( String systemId, boolean root ) throws SAXException, IOException { systemId = Options.normalizeSystemId(systemId); if( core.containsKey(systemId) ) // this document has already been parsed. Just ignore. return core.get(systemId); InputSource is=null; // allow entity resolver to find the actual byte stream. if( entityResolver!=null ) is = entityResolver.resolveEntity(null,systemId); if( is==null ) is = new InputSource(systemId); // but we still use the original system Id as the key. return parse( systemId, is, root ); }
Example #14
Source File: RELAXNGCompiler.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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 #15
Source File: Model.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * @param nc * Usually this should be set in the constructor, but we do allow this parameter * to be initially null, and then set later. * @param schemaComponent * The source schema model, if this is built from XSD. */ public Model( Options opts, JCodeModel cm, NameConverter nc, ClassNameAllocator allocator, XSSchemaSet schemaComponent ) { this.options = opts; this.codeModel = cm; this.nameConverter = nc; this.defaultSymbolSpace = new SymbolSpace(codeModel); defaultSymbolSpace.setType(codeModel.ref(Object.class)); elementMappings.put(null,new HashMap<QName,CElementInfo>()); if(opts.automaticNameConflictResolution) allocator = new AutoClassNameAllocator(allocator); this.allocator = new ClassNameAllocatorWrapper(allocator); this.schemaComponent = schemaComponent; this.gloablCustomizations.setParent(this,this); }
Example #16
Source File: RELAXNGCompiler.java From hottub with GNU General Public License v2.0 | 6 votes |
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 #17
Source File: PluginImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public boolean run(Outline model, Options opt, ErrorHandler errorHandler) { for( ClassOutline co : model.getClasses() ) { CPluginCustomization c = co.target.getCustomizations().find(Const.NS,"code"); if(c==null) continue; // no customization --- nothing to inject here c.markAsAcknowledged(); // TODO: ideally you should validate this DOM element to make sure // that there's no typo/etc. JAXP 1.3 can do this very easily. String codeFragment = DOMUtils.getElementText(c.element); // inject the specified code fragment into the implementation class. co.implClass.direct(codeFragment); } return true; }
Example #18
Source File: PluginImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public boolean run(Outline model, Options opt, ErrorHandler errorHandler) { for( ClassOutline co : model.getClasses() ) { CPluginCustomization c = co.target.getCustomizations().find(Const.NS,"code"); if(c==null) continue; // no customization --- nothing to inject here c.markAsAcknowledged(); // TODO: ideally you should validate this DOM element to make sure // that there's no typo/etc. JAXP 1.3 can do this very easily. String codeFragment = DOMUtils.getElementText(c.element); // inject the specified code fragment into the implementation class. co.implClass.direct(codeFragment); } return true; }
Example #19
Source File: SourceLocationAddOn.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public boolean run( Outline outline, Options opt, ErrorHandler errorHandler ) { for( ClassOutline ci : outline.getClasses() ) { JDefinedClass impl = ci.implClass; if (ci.getSuperClass() == null) { JVar $loc = impl.field(JMod.PROTECTED, Locator.class, fieldName); $loc.annotate(XmlLocation.class); $loc.annotate(XmlTransient.class); impl._implements(Locatable.class); impl.method(JMod.PUBLIC, Locator.class, "sourceLocation").body()._return($loc); JMethod setter = impl.method(JMod.PUBLIC, Void.TYPE, "setSourceLocation"); JVar $newLoc = setter.param(Locator.class, "newLocator"); setter.body().assign($loc, $newLoc); } } return true; }
Example #20
Source File: BGMBuilder.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * 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 #21
Source File: SchemaCompilerImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public SchemaCompilerImpl() { opts.compatibilityMode = Options.EXTENSION; resetSchema(); if(System.getProperty("xjc-api.test")!=null) { opts.debugMode = true; opts.verbose = true; } }
Example #22
Source File: AbstractExtensionBindingChecker.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * @param handler * This error handler will receive detected errors. */ public AbstractExtensionBindingChecker( String schemaLanguage, Options options, ErrorHandler handler ) { this.schemaLanguage = schemaLanguage; this.allowExtensions = options.compatibilityMode!=Options.STRICT; this.options = options; setErrorHandler(handler); for (Plugin plugin : options.getAllPlugins()) recognizableExtensions.addAll(plugin.getCustomizationURIs()); recognizableExtensions.add(Const.XJC_EXTENSION_URI); }
Example #23
Source File: DOMForest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public DOMForest( InternalizationLogic logic, Options opt ) { if (opt == null) throw new AssertionError("Options object null"); this.options = opt; try { DocumentBuilderFactory dbf = XmlFactory.createDocumentBuilderFactory(opt.disableXmlSecurity); this.documentBuilder = dbf.newDocumentBuilder(); this.parserFactory = XmlFactory.createParserFactory(opt.disableXmlSecurity); } catch( ParserConfigurationException e ) { throw new AssertionError(e); } this.logic = logic; }
Example #24
Source File: PluginImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public boolean run( Outline model, Options opt, ErrorHandler errorHandler ) { // we want this to work without requiring JSR-250 jar. annotation = model.getCodeModel().ref("javax.annotation.Generated"); for( ClassOutline co : model.getClasses() ) augument(co); for( EnumOutline eo : model.getEnums() ) augument(eo); //TODO: process generated ObjectFactory classes? return true; }
Example #25
Source File: PluginImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public boolean run( Outline model, Options opt, ErrorHandler errorHandler ) { // we want this to work without requiring JSR-250 jar. annotation = model.getCodeModel().ref("javax.annotation.Generated"); for( ClassOutline co : model.getClasses() ) augument(co); for( EnumOutline eo : model.getEnums() ) augument(eo); //TODO: process generated ObjectFactory classes? return true; }
Example #26
Source File: PluginImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
public boolean run( Outline model, Options opt, ErrorHandler errorHandler ) { // we want this to work without requiring JSR-250 jar. annotation = model.getCodeModel().ref("javax.annotation.Generated"); for( ClassOutline co : model.getClasses() ) augument(co); for( EnumOutline eo : model.getEnums() ) augument(eo); //TODO: process generated ObjectFactory classes? return true; }
Example #27
Source File: DOMForest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public DOMForest( InternalizationLogic logic, Options opt ) { if (opt == null) throw new AssertionError("Options object null"); this.options = opt; try { DocumentBuilderFactory dbf = XmlFactory.createDocumentBuilderFactory(opt.disableXmlSecurity); this.documentBuilder = dbf.newDocumentBuilder(); this.parserFactory = XmlFactory.createParserFactory(opt.disableXmlSecurity); } catch( ParserConfigurationException e ) { throw new AssertionError(e); } this.logic = logic; }
Example #28
Source File: DOMForest.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public DOMForest( InternalizationLogic logic, Options opt ) { if (opt == null) throw new AssertionError("Options object null"); this.options = opt; try { DocumentBuilderFactory dbf = XmlFactory.createDocumentBuilderFactory(opt.disableXmlSecurity); this.documentBuilder = dbf.newDocumentBuilder(); this.parserFactory = XmlFactory.createParserFactory(opt.disableXmlSecurity); } catch( ParserConfigurationException e ) { throw new AssertionError(e); } this.logic = logic; }
Example #29
Source File: TDTDReader.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
protected TDTDReader(ErrorReceiver errorReceiver, Options opts, InputSource _bindInfo) throws AbortException { this.entityResolver = opts.entityResolver; this.errorReceiver = new ErrorReceiverFilter(errorReceiver); bindInfo = new BindInfo(model,_bindInfo, this.errorReceiver); classFactory = new CodeModelClassFactory(errorReceiver); }
Example #30
Source File: AbstractExtensionBindingChecker.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * @param handler * This error handler will receive detected errors. */ public AbstractExtensionBindingChecker( String schemaLanguage, Options options, ErrorHandler handler ) { this.schemaLanguage = schemaLanguage; this.allowExtensions = options.compatibilityMode!=Options.STRICT; this.options = options; setErrorHandler(handler); for (Plugin plugin : options.getAllPlugins()) recognizableExtensions.addAll(plugin.getCustomizationURIs()); recognizableExtensions.add(Const.XJC_EXTENSION_URI); }