com.sun.xml.internal.bind.v2.model.core.NonElement Java Examples
The following examples show how to use
com.sun.xml.internal.bind.v2.model.core.NonElement.
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: ModelBuilder.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Have the builder recognize the type (if it hasn't done so yet), * and returns a {@link NonElement} that represents it. * * @return * always non-null. */ public NonElement<T,C> getTypeInfo(T t,Locatable upstream) { NonElement<T,C> r = typeInfoSet.getTypeInfo(t); if(r!=null) return r; if(nav.isArray(t)) { // no need for checking byte[], because above typeInfoset.getTypeInfo() would return non-null ArrayInfoImpl<T,C,F,M> ai = createArrayInfo(upstream, t); addTypeName(ai); typeInfoSet.add(ai); return ai; } C c = nav.asDecl(t); assert c!=null : t.toString()+" must be a leaf, but we failed to recognize it."; return getClassInfo(c,upstream); }
Example #2
Source File: JAXBModelImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private synchronized XmlSchemaGenerator<TypeMirror, TypeElement, VariableElement, ExecutableElement> getSchemaGenerator() { if(xsdgen==null) { xsdgen = new XmlSchemaGenerator<TypeMirror, TypeElement, VariableElement, ExecutableElement>(types.getNavigator(), types); for (Map.Entry<QName, Reference> e : additionalElementDecls.entrySet()) { Reference value = e.getValue(); if(value!=null) { NonElement<TypeMirror, TypeElement> typeInfo = refMap.get(value); if(typeInfo==null) throw new IllegalArgumentException(e.getValue()+" was not specified to JavaCompiler.bind"); TypeMirror type = value.type; xsdgen.add(e.getKey(), !(type != null && type.getKind().isPrimitive()), typeInfo); } else { xsdgen.add(e.getKey(),false,null); } } } return xsdgen; }
Example #3
Source File: ModelBuilder.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Have the builder recognize the type (if it hasn't done so yet), * and returns a {@link NonElement} that represents it. * * @return * always non-null. */ public NonElement<T,C> getTypeInfo(T t,Locatable upstream) { NonElement<T,C> r = typeInfoSet.getTypeInfo(t); if(r!=null) return r; if(nav.isArray(t)) { // no need for checking byte[], because above typeInfoset.getTypeInfo() would return non-null ArrayInfoImpl<T,C,F,M> ai = createArrayInfo(upstream, t); addTypeName(ai); typeInfoSet.add(ai); return ai; } C c = nav.asDecl(t); assert c!=null : t.toString()+" must be a leaf, but we failed to recognize it."; return getClassInfo(c,upstream); }
Example #4
Source File: ClassInfoImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public ClassInfoImpl<T,C,F,M> getBaseClass() { if (!baseClassComputed) { // compute the base class C s = nav().getSuperClass(clazz); if(s==null || s==nav().asDecl(Object.class)) { baseClass = null; } else { NonElement<T,C> b = builder.getClassInfo(s, true, this); if(b instanceof ClassInfoImpl) { baseClass = (ClassInfoImpl<T,C,F,M>) b; baseClass.hasSubClasses = true; } else { baseClass = null; } } baseClassComputed = true; } return baseClass; }
Example #5
Source File: ModelBuilder.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Have the builder recognize the type (if it hasn't done so yet), * and returns a {@link NonElement} that represents it. * * @return * always non-null. */ public NonElement<T,C> getTypeInfo(T t,Locatable upstream) { NonElement<T,C> r = typeInfoSet.getTypeInfo(t); if(r!=null) return r; if(nav.isArray(t)) { // no need for checking byte[], because above typeInfoset.getTypeInfo() would return non-null ArrayInfoImpl<T,C,F,M> ai = createArrayInfo(upstream, t); addTypeName(ai); typeInfoSet.add(ai); return ai; } C c = nav.asDecl(t); assert c!=null : t.toString()+" must be a leaf, but we failed to recognize it."; return getClassInfo(c,upstream); }
Example #6
Source File: ModelBuilder.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Have the builder recognize the type (if it hasn't done so yet), * and returns a {@link NonElement} that represents it. * * @return * always non-null. */ public NonElement<T,C> getTypeInfo(T t,Locatable upstream) { NonElement<T,C> r = typeInfoSet.getTypeInfo(t); if(r!=null) return r; if(nav.isArray(t)) { // no need for checking byte[], because above typeInfoset.getTypeInfo() would return non-null ArrayInfoImpl<T,C,F,M> ai = createArrayInfo(upstream, t); addTypeName(ai); typeInfoSet.add(ai); return ai; } C c = nav.asDecl(t); assert c!=null : t.toString()+" must be a leaf, but we failed to recognize it."; return getClassInfo(c,upstream); }
Example #7
Source File: ModelBuilder.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Have the builder recognize the type (if it hasn't done so yet), * and returns a {@link NonElement} that represents it. * * @return * always non-null. */ public NonElement<T,C> getTypeInfo(T t,Locatable upstream) { NonElement<T,C> r = typeInfoSet.getTypeInfo(t); if(r!=null) return r; if(nav.isArray(t)) { // no need for checking byte[], because above typeInfoset.getTypeInfo() would return non-null ArrayInfoImpl<T,C,F,M> ai = createArrayInfo(upstream, t); addTypeName(ai); typeInfoSet.add(ai); return ai; } C c = nav.asDecl(t); assert c!=null : t.toString()+" must be a leaf, but we failed to recognize it."; return getClassInfo(c,upstream); }
Example #8
Source File: SingleTypePropertyInfoImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void link() { super.link(); if (!(NonElement.ANYTYPE_NAME.equals(type.getTypeName()) || type.isSimpleType() || id()==ID.IDREF)) { parent.builder.reportError(new IllegalAnnotationException( Messages.SIMPLE_TYPE_IS_REQUIRED.format(), seed )); } if(!isCollection() && seed.hasAnnotation(XmlList.class)) { parent.builder.reportError(new IllegalAnnotationException( Messages.XMLLIST_ON_SINGLE_PROPERTY.format(), this )); } }
Example #9
Source File: ClassInfoImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public ClassInfoImpl<T,C,F,M> getBaseClass() { if (!baseClassComputed) { // compute the base class C s = nav().getSuperClass(clazz); if(s==null || s==nav().asDecl(Object.class)) { baseClass = null; } else { NonElement<T,C> b = builder.getClassInfo(s, true, this); if(b instanceof ClassInfoImpl) { baseClass = (ClassInfoImpl<T,C,F,M>) b; baseClass.hasSubClasses = true; } else { baseClass = null; } } baseClassComputed = true; } return baseClass; }
Example #10
Source File: XmlSchemaGenerator.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Process the given PropertyInfo looking for references to namespaces that * are foreign to the given namespace. Any foreign namespace references * found are added to the given namespaces dependency list and an <import> * is generated for it. * * @param p the PropertyInfo */ private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) { for (TypeInfo<T, C> t : p.ref()) { if ((t instanceof ClassInfo) && (processingDepth > 0)) { java.util.List<PropertyInfo> l = ((ClassInfo) t).getProperties(); for (PropertyInfo subp : l) { processForeignNamespaces(subp, --processingDepth); } } if (t instanceof Element) { addDependencyTo(((Element) t).getElementName()); } if (t instanceof NonElement) { addDependencyTo(((NonElement) t).getTypeName()); } } }
Example #11
Source File: ClassInfoImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public ClassInfoImpl<T,C,F,M> getBaseClass() { if (!baseClassComputed) { // compute the base class C s = nav().getSuperClass(clazz); if(s==null || s==nav().asDecl(Object.class)) { baseClass = null; } else { NonElement<T,C> b = builder.getClassInfo(s, true, this); if(b instanceof ClassInfoImpl) { baseClass = (ClassInfoImpl<T,C,F,M>) b; baseClass.hasSubClasses = true; } else { baseClass = null; } } baseClassComputed = true; } return baseClass; }
Example #12
Source File: JAXBModelImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private synchronized XmlSchemaGenerator<TypeMirror, TypeElement, VariableElement, ExecutableElement> getSchemaGenerator() { if(xsdgen==null) { xsdgen = new XmlSchemaGenerator<TypeMirror, TypeElement, VariableElement, ExecutableElement>(types.getNavigator(), types); for (Map.Entry<QName, Reference> e : additionalElementDecls.entrySet()) { Reference value = e.getValue(); if(value!=null) { NonElement<TypeMirror, TypeElement> typeInfo = refMap.get(value); if(typeInfo==null) throw new IllegalArgumentException(e.getValue()+" was not specified to JavaCompiler.bind"); TypeMirror type = value.type; xsdgen.add(e.getKey(), !(type != null && type.getKind().isPrimitive()), typeInfo); } else { xsdgen.add(e.getKey(),false,null); } } } return xsdgen; }
Example #13
Source File: XmlSchemaGenerator.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Process the given PropertyInfo looking for references to namespaces that * are foreign to the given namespace. Any foreign namespace references * found are added to the given namespaces dependency list and an <import> * is generated for it. * * @param p the PropertyInfo */ private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) { for (TypeInfo<T, C> t : p.ref()) { if ((t instanceof ClassInfo) && (processingDepth > 0)) { java.util.List<PropertyInfo> l = ((ClassInfo) t).getProperties(); for (PropertyInfo subp : l) { processForeignNamespaces(subp, --processingDepth); } } if (t instanceof Element) { addDependencyTo(((Element) t).getElementName()); } if (t instanceof NonElement) { addDependencyTo(((NonElement) t).getTypeName()); } } }
Example #14
Source File: SingleTypePropertyInfoImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void link() { super.link(); if (!(NonElement.ANYTYPE_NAME.equals(type.getTypeName()) || type.isSimpleType() || id()==ID.IDREF)) { parent.builder.reportError(new IllegalAnnotationException( Messages.SIMPLE_TYPE_IS_REQUIRED.format(), seed )); } if(!isCollection() && seed.hasAnnotation(XmlList.class)) { parent.builder.reportError(new IllegalAnnotationException( Messages.XMLLIST_ON_SINGLE_PROPERTY.format(), this )); } }
Example #15
Source File: XmlSchemaGenerator.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Process the given PropertyInfo looking for references to namespaces that * are foreign to the given namespace. Any foreign namespace references * found are added to the given namespaces dependency list and an <import> * is generated for it. * * @param p the PropertyInfo */ private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) { for (TypeInfo<T, C> t : p.ref()) { if ((t instanceof ClassInfo) && (processingDepth > 0)) { java.util.List<PropertyInfo> l = ((ClassInfo) t).getProperties(); for (PropertyInfo subp : l) { processForeignNamespaces(subp, --processingDepth); } } if (t instanceof Element) { addDependencyTo(((Element) t).getElementName()); } if (t instanceof NonElement) { addDependencyTo(((NonElement) t).getTypeName()); } } }
Example #16
Source File: ModelBuilder.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Have the builder recognize the type (if it hasn't done so yet), * and returns a {@link NonElement} that represents it. * * @return * always non-null. */ public NonElement<T,C> getTypeInfo(T t,Locatable upstream) { NonElement<T,C> r = typeInfoSet.getTypeInfo(t); if(r!=null) return r; if(nav.isArray(t)) { // no need for checking byte[], because above typeInfoset.getTypeInfo() would return non-null ArrayInfoImpl<T,C,F,M> ai = createArrayInfo(upstream, t); addTypeName(ai); typeInfoSet.add(ai); return ai; } C c = nav.asDecl(t); assert c!=null : t.toString()+" must be a leaf, but we failed to recognize it."; return getClassInfo(c,upstream); }
Example #17
Source File: JAXBContextImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private NonElement<Type,Class> getXmlType(RuntimeTypeInfoSet tis, TypeReference tr) { if(tr==null) throw new IllegalArgumentException(); XmlJavaTypeAdapter xjta = tr.get(XmlJavaTypeAdapter.class); XmlList xl = tr.get(XmlList.class); Ref<Type,Class> ref = new Ref<Type,Class>(annotationReader, tis.getNavigator(), tr.type, xjta, xl ); return tis.getTypeInfo(ref); }
Example #18
Source File: ModelBuilder.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Checks the uniqueness of the type name. */ private void addTypeName(NonElement<T, C> r) { QName t = r.getTypeName(); if(t==null) return; TypeInfo old = typeNames.put(t,r); if(old!=null) { // collision reportError(new IllegalAnnotationException( Messages.CONFLICTING_XML_TYPE_MAPPING.format(r.getTypeName()), old, r )); } }
Example #19
Source File: JAXBContextImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public QName getTypeName(TypeReference tr) { try { NonElement<Type,Class> xt = getXmlType(getTypeInfoSet(),tr); if(xt==null) throw new IllegalArgumentException(); return xt.getTypeName(); } catch (IllegalAnnotationsException e) { // impossible given that JAXBRIContext has been successfully built in the first place throw new AssertionError(e); } }
Example #20
Source File: JAXBModelImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private NonElement<TypeMirror, TypeElement> getXmlType(Reference r) { if(r==null) throw new IllegalArgumentException(); XmlJavaTypeAdapter xjta = r.annotations.getAnnotation(XmlJavaTypeAdapter.class); XmlList xl = r.annotations.getAnnotation(XmlList.class); Ref<TypeMirror, TypeElement> ref = new Ref<TypeMirror, TypeElement>( reader,types.getNavigator(),r.type,xjta,xl); return types.getTypeInfo(ref); }
Example #21
Source File: ModelBuilder.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Checks the uniqueness of the type name. */ private void addTypeName(NonElement<T, C> r) { QName t = r.getTypeName(); if(t==null) return; TypeInfo old = typeNames.put(t,r); if(old!=null) { // collision reportError(new IllegalAnnotationException( Messages.CONFLICTING_XML_TYPE_MAPPING.format(r.getTypeName()), old, r )); } }
Example #22
Source File: SingleTypePropertyInfoImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public NonElement<T,C> getTarget() { if(type==null) { assert parent.builder!=null : "this method must be called during the build stage"; type = parent.builder.getTypeInfo(getIndividualType(),this); } return type; }
Example #23
Source File: JAXBContextImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private XmlSchemaGenerator<Type,Class,Field,Method> createSchemaGenerator() { RuntimeTypeInfoSet tis; try { tis = getTypeInfoSet(); } catch (IllegalAnnotationsException e) { // this shouldn't happen because we've already throw new AssertionError(e); } XmlSchemaGenerator<Type,Class,Field,Method> xsdgen = new XmlSchemaGenerator<Type,Class,Field,Method>(tis.getNavigator(),tis); // JAX-RPC uses Bridge objects that collide with // @XmlRootElement. // we will avoid collision here Set<QName> rootTagNames = new HashSet<QName>(); for (RuntimeElementInfo ei : tis.getAllElements()) { rootTagNames.add(ei.getElementName()); } for (RuntimeClassInfo ci : tis.beans().values()) { if(ci.isElement()) rootTagNames.add(ci.asElement().getElementName()); } for (TypeReference tr : bridges.keySet()) { if(rootTagNames.contains(tr.tagName)) continue; if(tr.type==void.class || tr.type==Void.class) { xsdgen.add(tr.tagName,false,null); } else if(tr.type==CompositeStructure.class) { // this is a special class we introduced for JAX-WS that we *don't* want in the schema } else { NonElement<Type,Class> typeInfo = getXmlType(tis,tr); xsdgen.add(tr.tagName, !tis.getNavigator().isPrimitive(tr.type),typeInfo); } } return xsdgen; }
Example #24
Source File: ReferencePropertyInfoImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private boolean addAllSubtypes(T type) { Navigator<T,C,F,M> nav = nav(); // this allows the explicitly referenced type to be sucked in to the model NonElement<T,C> t = parent.builder.getClassInfo(nav.asDecl(type),this); if(!(t instanceof ClassInfo)) // this is leaf. return false; boolean result = false; ClassInfo<T,C> c = (ClassInfo<T,C>) t; if(c.isElement()) { types.add(c.asElement()); result = true; } // look for other possible types for( ClassInfo<T,C> ci : parent.owner.beans().values() ) { if(ci.isElement() && nav.isSubClassOf(ci.getType(),type)) { types.add(ci.asElement()); result = true; } } // don't allow local elements to substitute. for( ElementInfo<T,C> ei : parent.owner.getElementMappings(null).values()) { if(nav.isSubClassOf(ei.getType(),type)) { types.add(ei); result = true; } } return result; }
Example #25
Source File: JAXBModelImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public QName getXmlTypeName(Reference javaType) { NonElement<TypeMirror, TypeElement> ti = refMap.get(javaType); if(ti!=null) return ti.getTypeName(); return null; }
Example #26
Source File: SingleTypePropertyInfoImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
public NonElement<T,C> getTarget() { if(type==null) { assert parent.builder!=null : "this method must be called during the build stage"; type = parent.builder.getTypeInfo(getIndividualType(),this); } return type; }
Example #27
Source File: JAXBContextImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private XmlSchemaGenerator<Type,Class,Field,Method> createSchemaGenerator() { RuntimeTypeInfoSet tis; try { tis = getTypeInfoSet(); } catch (IllegalAnnotationsException e) { // this shouldn't happen because we've already throw new AssertionError(e); } XmlSchemaGenerator<Type,Class,Field,Method> xsdgen = new XmlSchemaGenerator<Type,Class,Field,Method>(tis.getNavigator(),tis); // JAX-RPC uses Bridge objects that collide with // @XmlRootElement. // we will avoid collision here Set<QName> rootTagNames = new HashSet<QName>(); for (RuntimeElementInfo ei : tis.getAllElements()) { rootTagNames.add(ei.getElementName()); } for (RuntimeClassInfo ci : tis.beans().values()) { if(ci.isElement()) rootTagNames.add(ci.asElement().getElementName()); } for (TypeReference tr : bridges.keySet()) { if(rootTagNames.contains(tr.tagName)) continue; if(tr.type==void.class || tr.type==Void.class) { xsdgen.add(tr.tagName,false,null); } else if(tr.type==CompositeStructure.class) { // this is a special class we introduced for JAX-WS that we *don't* want in the schema } else { NonElement<Type,Class> typeInfo = getXmlType(tis,tr); xsdgen.add(tr.tagName, !tis.getNavigator().isPrimitive(tr.type),typeInfo); } } return xsdgen; }
Example #28
Source File: SingleTypePropertyInfoImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public NonElement<T,C> getTarget() { if(type==null) { assert parent.builder!=null : "this method must be called during the build stage"; type = parent.builder.getTypeInfo(getIndividualType(),this); } return type; }
Example #29
Source File: SingleTypePropertyInfoImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public NonElement<T,C> getTarget() { if(type==null) { assert parent.builder!=null : "this method must be called during the build stage"; type = parent.builder.getTypeInfo(getIndividualType(),this); } return type; }
Example #30
Source File: XmlSchemaGenerator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Adds an additional element declaration. * * @param tagName * The name of the element declaration to be added. * @param type * The type this element refers to. * Can be null, in which case the element refers to an empty anonymous complex type. */ public void add( QName tagName, boolean isNillable, NonElement<T,C> type ) { if(type!=null && type.getType()==navigator.ref(CompositeStructure.class)) return; // this is a special class we introduced for JAX-WS that we *don't* want in the schema Namespace n = getNamespace(tagName.getNamespaceURI()); n.elementDecls.put(tagName.getLocalPart(), n.new ElementWithType(isNillable,type)); // search for foreign namespace references if(type!=null) n.addDependencyTo(type.getTypeName()); }