Module com.sun.xml.bind
Class ModelBuilder<T,C,F,M>
- java.lang.Object
-
- org.glassfish.jaxb.runtime.v2.model.impl.ModelBuilder<T,C,F,M>
-
- All Implemented Interfaces:
ModelBuilderI<T,C,F,M>
- Direct Known Subclasses:
RuntimeModelBuilder
public class ModelBuilder<T,C,F,M> extends Object implements ModelBuilderI<T,C,F,M>
Builds aTypeInfoSet(a set of JAXB properties) by usingElementInfoImplandClassInfoImpl. from annotated Java classes.This class uses
NavigatorandAnnotationReaderto work with arbitrary annotation source and arbitrary Java model. For this purpose this class is parameterized.- Author:
- Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
-
-
Field Summary
Fields Modifier and Type Field Description StringdefaultNsUriJAXB doesn't want to use namespaces unless we are told to, but WS-I BP conformace requires JAX-RPC to always use a non-empty namespace URI.booleanhasSwaRefSet to true if the model includesXmlAttachmentRef.Navigator<T,C,F,M>navAnnotationReader<T,C,F,M>reader
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RegistryInfo<T,C>addRegistry(C registryClass, Locatable upstream)Visits a class withXmlRegistryand records all the element mappings in it.protected ArrayInfoImpl<T,C,F,M>createArrayInfo(Locatable upstream, T arrayType)protected ClassInfoImpl<T,C,F,M>createClassInfo(C clazz, Locatable upstream)protected org.glassfish.jaxb.runtime.v2.model.impl.ElementInfoImpl<T,C,F,M>createElementInfo(org.glassfish.jaxb.runtime.v2.model.impl.RegistryInfoImpl<T,C,F,M> registryInfo, M m)protected org.glassfish.jaxb.runtime.v2.model.impl.EnumLeafInfoImpl<T,C,F,M>createEnumLeafInfo(C clazz, Locatable upstream)protected org.glassfish.jaxb.runtime.v2.model.impl.TypeInfoSetImpl<T,C,F,M>createTypeInfoSet()NonElement<T,C>getClassInfo(C clazz, boolean searchForSuperClass, Locatable upstream)For limited cases where the caller needs to search for a super class.NonElement<T,C>getClassInfo(C clazz, Locatable upstream)Builds a JAXBClassInfomodel from a given class declaration and adds that to this model owner.Navigator<T,C,F,M>getNavigator()AnnotationReader<T,C,F,M>getReader()RegistryInfo<T,C>getRegistry(String packageName)Gets aRegistryInfofor the given package.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 t, Locatable upstream)Have the builder recognize the type (if it hasn't done so yet), and returns aNonElementthat represents it.booleanisReplaced(C sc)TypeInfoSet<T,C,F,M>link()Called after all the classes are added to the type set to "link" them together.voidreportError(IllegalAnnotationException e)voidsetErrorHandler(ErrorHandler errorHandler)Sets the error handler that receives errors discovered during the model building.
-
-
-
Field Detail
-
reader
public final AnnotationReader<T,C,F,M> reader
-
defaultNsUri
public final String defaultNsUri
JAXB doesn't want to use namespaces unless we are told to, but WS-I BP conformace requires JAX-RPC to always use a non-empty namespace URI. (see http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html#WSDLTYPES R2105)To work around this issue, we allow the use of the empty namespaces to be replaced by a particular designated namespace URI.
This field keeps the value of that replacing namespace URI. When there's no replacement, this field is set to "".
-
hasSwaRef
public boolean hasSwaRef
Set to true if the model includesXmlAttachmentRef. JAX-WS needs to know this information.
-
-
Method Detail
-
createTypeInfoSet
protected org.glassfish.jaxb.runtime.v2.model.impl.TypeInfoSetImpl<T,C,F,M> createTypeInfoSet()
-
getClassInfo
public NonElement<T,C> getClassInfo(C clazz, Locatable upstream)
-
getClassInfo
public NonElement<T,C> getClassInfo(C clazz, boolean searchForSuperClass, Locatable upstream)
For limited cases where the caller needs to search for a super class. This is necessary because we don't wantsubclassReplacementsto kick in for the super class search, which will cause infinite recursion.
-
getTypeInfo
public NonElement<T,C> getTypeInfo(T t, Locatable upstream)
Have the builder recognize the type (if it hasn't done so yet), and returns aNonElementthat represents it.- Returns:
- always non-null.
-
getTypeInfo
public NonElement<T,C> getTypeInfo(Ref<T,C> ref)
This method is used to add a root reference to a model.
-
createEnumLeafInfo
protected org.glassfish.jaxb.runtime.v2.model.impl.EnumLeafInfoImpl<T,C,F,M> createEnumLeafInfo(C clazz, Locatable upstream)
-
createElementInfo
protected org.glassfish.jaxb.runtime.v2.model.impl.ElementInfoImpl<T,C,F,M> createElementInfo(org.glassfish.jaxb.runtime.v2.model.impl.RegistryInfoImpl<T,C,F,M> registryInfo, M m) throws IllegalAnnotationException
- Throws:
IllegalAnnotationException
-
createArrayInfo
protected ArrayInfoImpl<T,C,F,M> createArrayInfo(Locatable upstream, T arrayType)
-
addRegistry
public RegistryInfo<T,C> addRegistry(C registryClass, Locatable upstream)
Visits a class withXmlRegistryand records all the element mappings in it.
-
getRegistry
public RegistryInfo<T,C> getRegistry(String packageName)
Gets aRegistryInfofor the given package.- Returns:
- null if no registry exists for the package. unlike other getXXX methods on this class, this method is side-effect free.
-
link
public TypeInfoSet<T,C,F,M> link()
Called after all the classes are added to the type set to "link" them together.Don't expose implementation classes in the signature.
- Returns:
- fully built
TypeInfoSetthat represents the model, or null if there was an error.
-
setErrorHandler
public void setErrorHandler(ErrorHandler errorHandler)
Sets the error handler that receives errors discovered during the model building.- Parameters:
errorHandler- can be null.
-
reportError
public final void reportError(IllegalAnnotationException e)
-
isReplaced
public boolean isReplaced(C sc)
-
getNavigator
public Navigator<T,C,F,M> getNavigator()
- Specified by:
getNavigatorin interfaceModelBuilderI<T,C,F,M>
-
-