com.sun.xml.internal.xsom.XSElementDecl Java Examples
The following examples show how to use
com.sun.xml.internal.xsom.XSElementDecl.
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: SchemaTreeTraverser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Creates node for element declaration with additional attributes. * * @param decl Element declaration. * @param extraAtts Additional attributes. */ private void elementDecl(XSElementDecl decl, String extraAtts) { XSType type = decl.getType(); // TODO: various other attributes String str = MessageFormat.format("Element name=\"{0}\"{1}{2}", new Object[]{ decl.getName(), type.isLocal() ? "" : " type=\"{" + type.getTargetNamespace() + "}" + type.getName() + "\"", extraAtts}); SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator()); this.currNode.add(newNode); this.currNode = newNode; if (type.isLocal()) { if (type.isLocal()) { type.visit(this); } } this.currNode = (SchemaTreeNode) this.currNode.getParent(); }
Example #2
Source File: DefaultClassBinder.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * If only one global {@link XSElementDecl} is refering to {@link XSType}, * return that element, otherwise null. */ private @Nullable XSElementDecl getSoleElementReferer(@NotNull XSType t) { Set<XSComponent> referer = builder.getReferer(t); XSElementDecl sole = null; for (XSComponent r : referer) { if(r instanceof XSElementDecl) { XSElementDecl x = (XSElementDecl) r; if(!x.isGlobal()) // local element references can be ignored, as their names are either given // by the property, or by the JAXBElement (for things like mixed contents) continue; if(sole==null) sole=x; else return null; // more than one } else { // if another type refers to this type, that means // this type has a sub-type, so type substitution is possible now. return null; } } return sole; }
Example #3
Source File: CElementInfo.java From hottub with GNU General Public License v2.0 | 6 votes |
public void initContentType(TypeUse contentType, @Nullable XSElementDecl source, XmlString defaultValue) { assert this.property==null; // must not be called twice this.property = new CElementPropertyInfo("Value", contentType.isCollection()?REPEATED_VALUE:NOT_REPEATED, contentType.idUse(), contentType.getExpectedMimeType(), source,null,getLocator(),true); this.property.setAdapter(contentType.getAdapterUse()); BIInlineBinaryData.handle(source,property); property.getTypes().add(new CTypeRef(contentType.getInfo(),tagName,CTypeRef.getSimpleTypeName(source), true,defaultValue)); this.type = NavigatorImpl.createParameterizedType( NavigatorImpl.theInstance.ref(JAXBElement.class), getContentInMemoryType() ); BIFactoryMethod factoryMethod = Ring.get(BGMBuilder.class).getBindInfo(source).get(BIFactoryMethod.class); if(factoryMethod!=null) { factoryMethod.markAsAcknowledged(); this.squeezedName = factoryMethod.name; } }
Example #4
Source File: SchemaTreeTraverser.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Creates node for element declaration with additional attributes. * * @param decl Element declaration. * @param extraAtts Additional attributes. */ private void elementDecl(XSElementDecl decl, String extraAtts) { XSType type = decl.getType(); // TODO: various other attributes String str = MessageFormat.format("Element name=\"{0}\"{1}{2}", new Object[]{ decl.getName(), type.isLocal() ? "" : " type=\"{" + type.getTargetNamespace() + "}" + type.getName() + "\"", extraAtts}); SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator()); this.currNode.add(newNode); this.currNode = newNode; if (type.isLocal()) { if (type.isLocal()) { type.visit(this); } } this.currNode = (SchemaTreeNode) this.currNode.getParent(); }
Example #5
Source File: DefaultClassBinder.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * If only one global {@link XSElementDecl} is refering to {@link XSType}, * return that element, otherwise null. */ private @Nullable XSElementDecl getSoleElementReferer(@NotNull XSType t) { Set<XSComponent> referer = builder.getReferer(t); XSElementDecl sole = null; for (XSComponent r : referer) { if(r instanceof XSElementDecl) { XSElementDecl x = (XSElementDecl) r; if(!x.isGlobal()) // local element references can be ignored, as their names are either given // by the property, or by the JAXBElement (for things like mixed contents) continue; if(sole==null) sole=x; else return null; // more than one } else { // if another type refers to this type, that means // this type has a sub-type, so type substitution is possible now. return null; } } return sole; }
Example #6
Source File: RawTypeSetBuilder.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void elementDecl(XSElementDecl decl) { QName n = BGMBuilder.getName(decl); if(elementNames.add(n)) { CElement elementBean = Ring.get(ClassSelector.class).bindToType(decl,null); if(elementBean==null) refs.add(new XmlTypeRef(decl)); else { // yikes! if(elementBean instanceof CClass) refs.add(new CClassRef(decl,(CClass)elementBean)); else refs.add(new CElementInfoRef(decl,(CElementInfo)elementBean)); } } }
Example #7
Source File: DefaultClassBinder.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * If only one global {@link XSElementDecl} is refering to {@link XSType}, * return that element, otherwise null. */ private @Nullable XSElementDecl getSoleElementReferer(@NotNull XSType t) { Set<XSComponent> referer = builder.getReferer(t); XSElementDecl sole = null; for (XSComponent r : referer) { if(r instanceof XSElementDecl) { XSElementDecl x = (XSElementDecl) r; if(!x.isGlobal()) // local element references can be ignored, as their names are either given // by the property, or by the JAXBElement (for things like mixed contents) continue; if(sole==null) sole=x; else return null; // more than one } else { // if another type refers to this type, that means // this type has a sub-type, so type substitution is possible now. return null; } } return sole; }
Example #8
Source File: CElementInfo.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void initContentType(TypeUse contentType, @Nullable XSElementDecl source, XmlString defaultValue) { assert this.property==null; // must not be called twice this.property = new CElementPropertyInfo("Value", contentType.isCollection()?REPEATED_VALUE:NOT_REPEATED, contentType.idUse(), contentType.getExpectedMimeType(), source,null,getLocator(),true); this.property.setAdapter(contentType.getAdapterUse()); BIInlineBinaryData.handle(source,property); property.getTypes().add(new CTypeRef(contentType.getInfo(),tagName,CTypeRef.getSimpleTypeName(source), true,defaultValue)); this.type = NavigatorImpl.createParameterizedType( NavigatorImpl.theInstance.ref(JAXBElement.class), getContentInMemoryType() ); BIFactoryMethod factoryMethod = Ring.get(BGMBuilder.class).getBindInfo(source).get(BIFactoryMethod.class); if(factoryMethod!=null) { factoryMethod.markAsAcknowledged(); this.squeezedName = factoryMethod.name; } }
Example #9
Source File: ClassSelector.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Determines if the given component needs to have a value * constructor (a constructor that takes a parmater.) on ObjectFactory. */ private boolean needValueConstructor( XSComponent sc ) { if(!(sc instanceof XSElementDecl)) return false; XSElementDecl decl = (XSElementDecl)sc; if(!decl.getType().isSimpleType()) return false; return true; }
Example #10
Source File: ExpressionBuilder.java From hottub with GNU General Public License v2.0 | 5 votes |
public Element elementDecl(XSElementDecl decl) { QName n = BGMBuilder.getName(decl); GElementImpl e = decls.get(n); if(e==null) decls.put(n,e=new GElementImpl(n,decl)); e.particles.add(current); assert current.getTerm()==decl; return e; }
Example #11
Source File: UnusedCustomizationChecker.java From hottub with GNU General Public License v2.0 | 5 votes |
public void elementDecl(XSElementDecl decl) { if(check(decl)) { decl.getType().visit(this); for( XSIdentityConstraint id : decl.getIdentityConstraints() ) id.visit(this); } }
Example #12
Source File: SchemaWriter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private void elementDecl( XSElementDecl decl, String extraAtts ) { XSType type = decl.getType(); // TODO: various other attributes // qualified attr; Issue if(decl.getForm() != null) { extraAtts += " form=\"" + (decl.getForm() ? "qualified" : "unqualified" ) + "\""; } println(MessageFormat.format("<element name=\"{0}\"{1}{2}{3}>", decl.getName(), type.isLocal()?"":" type=\"{"+ type.getTargetNamespace()+'}'+ type.getName()+'\"', extraAtts, type.isLocal()?"":"/")); if(type.isLocal()) { indent++; if(type.isLocal()) type.visit(this); indent--; println("</element>"); } }
Example #13
Source File: UnusedCustomizationChecker.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public void elementDecl(XSElementDecl decl) { if(check(decl)) { decl.getType().visit(this); for( XSIdentityConstraint id : decl.getIdentityConstraints() ) id.visit(this); } }
Example #14
Source File: RefererFinder.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void schema(XSSchema xs) { if(!visited.add(xs)) return; for (XSComplexType ct : xs.getComplexTypes().values()) { complexType(ct); } for (XSElementDecl e : xs.getElementDecls().values()) { elementDecl(e); } }
Example #15
Source File: ElementDecl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
protected void addSubstitutable( ElementDecl decl ) { if( substitutables==null ) { substitutables = new HashSet<XSElementDecl>(); substitutables.add(this); substitutablesView = Collections.unmodifiableSet(substitutables); } substitutables.add(decl); }
Example #16
Source File: ElementDecl.java From hottub with GNU General Public License v2.0 | 5 votes |
protected void addSubstitutable( ElementDecl decl ) { if( substitutables==null ) { substitutables = new HashSet<XSElementDecl>(); substitutables.add(this); substitutablesView = Collections.unmodifiableSet(substitutables); } substitutables.add(decl); }
Example #17
Source File: ClassSelector.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Determines if the given component needs to have a value * constructor (a constructor that takes a parmater.) on ObjectFactory. */ private boolean needValueConstructor( XSComponent sc ) { if(!(sc instanceof XSElementDecl)) return false; XSElementDecl decl = (XSElementDecl)sc; if(!decl.getType().isSimpleType()) return false; return true; }
Example #18
Source File: RefererFinder.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void schema(XSSchema xs) { if(!visited.add(xs)) return; for (XSComplexType ct : xs.getComplexTypes().values()) { complexType(ct); } for (XSElementDecl e : xs.getElementDecls().values()) { elementDecl(e); } }
Example #19
Source File: RefererFinder.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void schema(XSSchema xs) { if(!visited.add(xs)) return; for (XSComplexType ct : xs.getComplexTypes().values()) { complexType(ct); } for (XSElementDecl e : xs.getElementDecls().values()) { elementDecl(e); } }
Example #20
Source File: ClassSelector.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Checks if the given component is bound to a class. */ public final CElement isBound( XSElementDecl x, XSComponent referer ) { CElementInfo r = boundElements.get(x); if(r!=null) return r; return bindToType(x,referer); }
Example #21
Source File: DefaultClassBinder.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Returns true if the complex type of the given element can be "optimized away" * and unified with its parent element decl to form a single class. */ private boolean isCollapsable(XSElementDecl decl) { XSType type = decl.getType(); if(!type.isComplexType()) return false; // not a complex type if(decl.getSubstitutables().size()>1 || decl.getSubstAffiliation()!=null) // because element substitution calls for a proper JAXBElement hierarchy return false; if(decl.isNillable()) // because nillable needs JAXBElement to represent correctly return false; BIXSubstitutable bixSubstitutable = builder.getBindInfo(decl).get(BIXSubstitutable.class); if(bixSubstitutable !=null) { // see https://jaxb.dev.java.net/issues/show_bug.cgi?id=289 // this customization forces non-collapsing behavior. bixSubstitutable.markAsAcknowledged(); return false; } if( getGlobalBinding().isSimpleMode() && decl.isGlobal()) { // in the simple mode, we do more aggressive optimization, and get rid of // a complex type class if it's only used once from a global element XSElementDecl referer = getSoleElementReferer(decl.getType()); if(referer!=null) { assert referer==decl; // I must be the sole referer return true; } } if(!type.isLocal() || !type.isComplexType()) return false; return true; }
Example #22
Source File: RawTypeSetBuilder.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public XmlTypeRef(XSElementDecl decl) { this.decl = decl; SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class); stb.refererStack.push(decl); TypeUse r = Ring.get(ClassSelector.class).bindToType(decl.getType(),decl); stb.refererStack.pop(); target = r; }
Example #23
Source File: SchemaWriter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private void elementDecl( XSElementDecl decl, String extraAtts ) { XSType type = decl.getType(); // TODO: various other attributes // qualified attr; Issue if(decl.getForm() != null) { extraAtts += " form=\"" + (decl.getForm() ? "qualified" : "unqualified" ) + "\""; } println(MessageFormat.format("<element name=\"{0}\"{1}{2}{3}>", decl.getName(), type.isLocal()?"":" type=\"{"+ type.getTargetNamespace()+'}'+ type.getName()+'\"', extraAtts, type.isLocal()?"":"/")); if(type.isLocal()) { indent++; if(type.isLocal()) type.visit(this); indent--; println("</element>"); } }
Example #24
Source File: ElementDecl.java From hottub with GNU General Public License v2.0 | 5 votes |
public Set<? extends XSElementDecl> getSubstitutables() { if( substitutables==null ) { // if the field is null by the time this method // is called, it means this element is substitutable by itself only. substitutables = substitutablesView = Collections.singleton((XSElementDecl)this); } return substitutablesView; }
Example #25
Source File: SchemaWriter.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void schema( XSSchema s ) { // QUICK HACK: don't print the built-in components if(s.getTargetNamespace().equals(Const.schemaNamespace)) return; println(MessageFormat.format("<schema targetNamespace=\"{0}\">", s.getTargetNamespace())); indent++; Iterator itr; itr = s.iterateAttGroupDecls(); while(itr.hasNext()) attGroupDecl( (XSAttGroupDecl)itr.next() ); itr = s.iterateAttributeDecls(); while(itr.hasNext()) attributeDecl( (XSAttributeDecl)itr.next() ); itr = s.iterateComplexTypes(); while(itr.hasNext()) complexType( (XSComplexType)itr.next() ); itr = s.iterateElementDecls(); while(itr.hasNext()) elementDecl( (XSElementDecl)itr.next() ); itr = s.iterateModelGroupDecls(); while(itr.hasNext()) modelGroupDecl( (XSModelGroupDecl)itr.next() ); itr = s.iterateSimpleTypes(); while(itr.hasNext()) simpleType( (XSSimpleType)itr.next() ); indent--; println("</schema>"); }
Example #26
Source File: ComplexTypeImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public List<XSElementDecl> getElementDecls() { ArrayList declList = new ArrayList(); XSSchemaSet schemaSet = getRoot(); for (XSSchema sch : schemaSet.getSchemas()) { for (XSElementDecl decl : sch.getElementDecls().values()) { if (decl.getType().equals(this)) { declList.add(decl); } } } return declList; }
Example #27
Source File: SchemaSetImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public Iterator<XSElementDecl> iterateElementDecls() { return new Iterators.Map<XSElementDecl,XSSchema>(iterateSchema()) { protected Iterator<XSElementDecl> apply(XSSchema u) { return u.iterateElementDecls(); } }; }
Example #28
Source File: ElementDecl.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * @deprecated */ @Override public XSElementDecl[] listSubstitutables() { Set<? extends XSElementDecl> s = getSubstitutables(); return s.toArray(new XSElementDecl[s.size()]); }
Example #29
Source File: IdentityConstraintImpl.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public XSElementDecl getParent() { return parent; }
Example #30
Source File: ClassSelector.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public CElement bindToType( XSElementDecl e, XSComponent referer ) { return (CElement)_bindToClass(e,referer,false); }