com.sun.xml.bind.v2.model.impl
Class TypeInfoSetImpl<T,C,F,M>

java.lang.Object
  extended by com.sun.xml.bind.v2.model.impl.TypeInfoSetImpl<T,C,F,M>
All Implemented Interfaces:
TypeInfoSet<T,C,F,M>
Direct Known Subclasses:
RuntimeTypeInfoSetImpl

 class TypeInfoSetImpl<T,C,F,M>
extends Object
implements TypeInfoSet<T,C,F,M>

Set of TypeInfos.

This contains a fixed set of LeafInfos and arbitrary set of ClassInfos.

Members are annotated with JAXB annotations so that we can dump it easily.


Field Summary
 Navigator<T,C,F,M> nav
           
 AnnotationReader<T,C,F,M> reader
           
 
Constructor Summary
TypeInfoSetImpl(Navigator<T,C,F,M> nav, AnnotationReader<T,C,F,M> reader, Map<T,? extends BuiltinLeafInfoImpl<T,C>> leaves)
           
 
Method Summary
 void add(ArrayInfoImpl<T,C,F,M> ai)
           
 void add(ClassInfoImpl<T,C,F,M> ci)
          Adds a new ClassInfo to the set.
 void add(ElementInfoImpl<T,C,F,M> ei, ModelBuilder<T,C,F,M> builder)
           
 void add(EnumLeafInfoImpl<T,C,F,M> li)
          Adds a new LeafInfo to the set.
 Map<? extends T,? extends ArrayInfoImpl<T,C,F,M>> arrays()
          Returns all the ArrayInfos known to this set.
 Map<C,? extends ClassInfoImpl<T,C,F,M>> beans()
          Returns all the ClassInfos known to this set.
 Map<T,? extends BuiltinLeafInfo<T,C>> builtins()
          Returns all the BuiltinLeafInfos known to this set.
protected  NonElement<T,C> createAnyType()
           
 void dump(Result out)
          Dumps this model into XML.
 Map<C,? extends EnumLeafInfoImpl<T,C,F,M>> enums()
          Returns all the EnumLeafInfos known to this set.
 Iterable<? extends ElementInfoImpl<T,C,F,M>> getAllElements()
          Returns all the ElementInfo known to this set.
 NonElement<T,C> getAnyTypeInfo()
          Gets the TypeInfo for the any type.
 XmlNsForm getAttributeFormDefault(String nsUri)
          Gets the reasonable XmlNsForm for the given namespace URI.
 NonElement<T,C> getClassInfo(C type)
          Returns a ClassInfo for the given bean.
 XmlNsForm getElementFormDefault(String nsUri)
          Gets the reasonable XmlNsForm for the given namespace URI.
 ElementInfoImpl<T,C,F,M> getElementInfo(C scope, QName name)
          Returns a ElementInfo for the given element.
 Map<QName,? extends ElementInfoImpl<T,C,F,M>> getElementMappings(C scope)
          Returns all ElementInfos in the given scope.
 Navigator<T,C,F,M> getNavigator()
          Navigator for this model.
 Map<String,String> getSchemaLocations()
          Gets XmlSchema.location() found in this context.
 NonElement<T,C> getTypeInfo(Ref<T,C> ref)
          This method is used to add a root reference to a model.
 NonElement<T,C> getTypeInfo(T type)
          Returns a TypeInfo for the given type.
 Map<String,String> getXmlNs(String namespaceUri)
          Gets all XmlSchema.xmlns() found in this context for the given namespace URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nav

public final Navigator<T,C,F,M> nav

reader

public final AnnotationReader<T,C,F,M> reader
Constructor Detail

TypeInfoSetImpl

public TypeInfoSetImpl(Navigator<T,C,F,M> nav,
                       AnnotationReader<T,C,F,M> reader,
                       Map<T,? extends BuiltinLeafInfoImpl<T,C>> leaves)
Method Detail

createAnyType

protected NonElement<T,C> createAnyType()

getNavigator

public Navigator<T,C,F,M> getNavigator()
Description copied from interface: TypeInfoSet
Navigator for this model.

Specified by:
getNavigator in interface TypeInfoSet<T,C,F,M>

add

public void add(ClassInfoImpl<T,C,F,M> ci)
Adds a new ClassInfo to the set.


add

public void add(EnumLeafInfoImpl<T,C,F,M> li)
Adds a new LeafInfo to the set.


add

public void add(ArrayInfoImpl<T,C,F,M> ai)

getTypeInfo

public NonElement<T,C> getTypeInfo(T type)
Returns a TypeInfo for the given type.

Specified by:
getTypeInfo in interface TypeInfoSet<T,C,F,M>
Returns:
null if the specified type cannot be bound by JAXB, or not known to this set.

getAnyTypeInfo

public NonElement<T,C> getAnyTypeInfo()
Description copied from interface: TypeInfoSet
Gets the TypeInfo for the any type.

Specified by:
getAnyTypeInfo in interface TypeInfoSet<T,C,F,M>

getTypeInfo

public NonElement<T,C> getTypeInfo(Ref<T,C> ref)
This method is used to add a root reference to a model.

Specified by:
getTypeInfo in interface TypeInfoSet<T,C,F,M>

beans

public Map<C,? extends ClassInfoImpl<T,C,F,M>> beans()
Returns all the ClassInfos known to this set.

Specified by:
beans in interface TypeInfoSet<T,C,F,M>

builtins

public Map<T,? extends BuiltinLeafInfo<T,C>> builtins()
Description copied from interface: TypeInfoSet
Returns all the BuiltinLeafInfos known to this set.

Specified by:
builtins in interface TypeInfoSet<T,C,F,M>

enums

public Map<C,? extends EnumLeafInfoImpl<T,C,F,M>> enums()
Description copied from interface: TypeInfoSet
Returns all the EnumLeafInfos known to this set.

Specified by:
enums in interface TypeInfoSet<T,C,F,M>

arrays

public Map<? extends T,? extends ArrayInfoImpl<T,C,F,M>> arrays()
Description copied from interface: TypeInfoSet
Returns all the ArrayInfos known to this set.

Specified by:
arrays in interface TypeInfoSet<T,C,F,M>

getClassInfo

public NonElement<T,C> getClassInfo(C type)
Returns a ClassInfo for the given bean.

This method is almost like refinement of getTypeInfo(Object) except our C cannot derive from T.

Specified by:
getClassInfo in interface TypeInfoSet<T,C,F,M>
Returns:
null if the specified type is not bound by JAXB or otherwise unknown to this set.

getElementInfo

public ElementInfoImpl<T,C,F,M> getElementInfo(C scope,
                                               QName name)
Description copied from interface: TypeInfoSet
Returns a ElementInfo for the given element.

Specified by:
getElementInfo in interface TypeInfoSet<T,C,F,M>
Parameters:
scope - if null, return the info about a global element. Otherwise return a local element in the given scope if available, then look for a global element next.

add

public final void add(ElementInfoImpl<T,C,F,M> ei,
                      ModelBuilder<T,C,F,M> builder)
Parameters:
builder - used for reporting errors.

getElementMappings

public Map<QName,? extends ElementInfoImpl<T,C,F,M>> getElementMappings(C scope)
Description copied from interface: TypeInfoSet
Returns all ElementInfos in the given scope.

Specified by:
getElementMappings in interface TypeInfoSet<T,C,F,M>
Parameters:
scope - if non-null, this method only returns the local element mapping.

getAllElements

public Iterable<? extends ElementInfoImpl<T,C,F,M>> getAllElements()
Description copied from interface: TypeInfoSet
Returns all the ElementInfo known to this set.

Specified by:
getAllElements in interface TypeInfoSet<T,C,F,M>

getXmlNs

public Map<String,String> getXmlNs(String namespaceUri)
Description copied from interface: TypeInfoSet
Gets all XmlSchema.xmlns() found in this context for the given namespace URI.

This operation is expected to be only used in schema generator, so it can be slow.

Specified by:
getXmlNs in interface TypeInfoSet<T,C,F,M>
Returns:
A map from prefixes to namespace URIs, which should be declared when generating a schema. Could be empty but never null.

getSchemaLocations

public Map<String,String> getSchemaLocations()
Description copied from interface: TypeInfoSet
Gets XmlSchema.location() found in this context.

This operation is expected to be only used in schema generator, so it can be slow.

Specified by:
getSchemaLocations in interface TypeInfoSet<T,C,F,M>
Returns:
A map from namespace URI to the value of the location. If the entry is missing, that means a schema should be generated for that namespace. If the value is "", that means the schema location is implied (<xs:schema namespace="..."/> w/o schemaLocation.)

getElementFormDefault

public final XmlNsForm getElementFormDefault(String nsUri)
Description copied from interface: TypeInfoSet
Gets the reasonable XmlNsForm for the given namespace URI.

The spec doesn't define very precisely what the XmlNsForm value for the given namespace would be, so this method is implemented in rather ad-hoc way. It should work as what most people expect for simple cases.

Specified by:
getElementFormDefault in interface TypeInfoSet<T,C,F,M>
Returns:
never null.

getAttributeFormDefault

public final XmlNsForm getAttributeFormDefault(String nsUri)
Description copied from interface: TypeInfoSet
Gets the reasonable XmlNsForm for the given namespace URI.

The spec doesn't define very precisely what the XmlNsForm value for the given namespace would be, so this method is implemented in rather ad-hoc way. It should work as what most people expect for simple cases.

Specified by:
getAttributeFormDefault in interface TypeInfoSet<T,C,F,M>
Returns:
never null.

dump

public void dump(Result out)
          throws JAXBException
Dumps this model into XML. For debug only. TODO: not sure if this actually works. We don't really know what are T,C.

Specified by:
dump in interface TypeInfoSet<T,C,F,M>
Throws:
JAXBException