Module org.eclipse.persistence.moxy
Class ElementDeclaration
java.lang.Object
org.eclipse.persistence.jaxb.compiler.ElementDeclaration
An ElementDeclaration object is used to represent the information that is associated with a global element in XML.
ElementDeclarations will be created for classes with an XMLRootElement annotation, for TypeMappingInfo objects which have an xml tag name specified.
-
Constructor Summary
ConstructorDescriptionElementDeclaration
(QName name, JavaClass javaType, String javaTypeName, boolean isList) Create a new ElementDeclaration.ElementDeclaration
(QName name, JavaClass javaType, String javaTypeName, boolean isList, Class<?> scopeClass) Create a new ElementDeclaration and set the scope. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an element to the list of elements which can be substituted for this element (ie: has this element in their substitutionGroup)Get the adapted java type.Get the adapted java type name.This will be set if XmlElementDecl has a defaultValue specifiedGet the QName representing this elementThe javaType associated with this element.Class
<?> Get the java type adapter class associated with the elementGet the name of the java type associated with this global element.Class
<?> Get the scope class associated with this element.The list of elements which can be substituted for this element (ie: has this element in their substitutionGroup)If this element has a substitutionGroup this will be set.Get the TypeMappingInfo object if this ElementDeclaration was created from a TypeMappingInfoReturn the mimeType specified on this element.boolean
isList()
Return if this element is a listboolean
Return if the global element will be marked as nillableboolean
Return if this element is associated with an XmlAttachmentRef annotationboolean
Track if this element had an @XmlRootElement annotationvoid
setAdaptedJavaType
(JavaClass adaptedJavaType) Set the adapted java type if there is an XmlJavaTypeAdapter associated with this element This will also set the adaptedJavaTypeName (getAdaptedJavaTypeName)void
setDefaultValue
(String value) Set the default value associated with this element.void
setIsXmlRootElement
(boolean isXmlRoot) Mark if this element had an @XmlRootElement annotationvoid
setJavaType
(JavaClass type) Set the javaType associated with this element.void
setJavaTypeAdapterClass
(Class<?> javaTypeAdapterClass) Set the java type adapter class associated with this element if applicable.void
setList
(boolean isList) Mark if this element is a listvoid
setNillable
(boolean nillable) Set if the global element should be marked as nillablevoid
setScopeClass
(Class<?> scopeClass) Set the scope class associated with this element.void
setSubstitutionHead
(QName rootElement) If this element has a substitutionGroup this will be set.void
Set the TypeMappingInfo object if this ElementDeclaration was created from a TypeMappingInfovoid
setXmlAttachmentRef
(boolean xmlAttachmentRef) Set if there is an XmlAttachmentRef annotations associated with this element.void
setXmlMimeType
(String xmlMimeType) Set of this element has an XmlMimeType annotation
-
Constructor Details
-
ElementDeclaration
Create a new ElementDeclaration. By default the scope of this ElementDeclaration will be XmlElementDecl.GLOBAL- Parameters:
name
- The QName of this elementjavaType
- The JavaClass of this elementjavaTypeName
- The String name of the javaTypeisList
- A boolean representing if this corresponds to an xsd:list
-
ElementDeclaration
public ElementDeclaration(QName name, JavaClass javaType, String javaTypeName, boolean isList, Class<?> scopeClass) Create a new ElementDeclaration and set the scope.- Parameters:
name
- The QName of this elementjavaType
- The JavaClass of this elementjavaTypeName
- The String name of the javaTypeisList
- A boolean representing if this corresponds to an xsd:listscopeClass
- The class representing the scope of this element
-
-
Method Details
-
getElementName
Get the QName representing this element- Returns:
- the QName associated with this element.
-
getJavaTypeName
Get the name of the java type associated with this global element. This may be set through the constructor or will be set when setJavaType(JavaClass) is called.- Returns:
- the name of the java type that corresponds to this element
-
getSubstitutableElements
The list of elements which can be substituted for this element (ie: has this element in their substitutionGroup)- Returns:
- the list of element declarations which can be substituted for this element
-
addSubstitutableElement
Add an element to the list of elements which can be substituted for this element (ie: has this element in their substitutionGroup) -
setSubstitutionHead
If this element has a substitutionGroup this will be set.- Parameters:
rootElement
- the QName value of the substitutionGroup
-
getSubstitutionHead
If this element has a substitutionGroup this will be set.- Returns:
- the value of the substitutionGroup
-
isXmlRootElement
public boolean isXmlRootElement()Track if this element had an @XmlRootElement annotation- Returns:
- if the element has an @XmlRootElement
-
setIsXmlRootElement
public void setIsXmlRootElement(boolean isXmlRoot) Mark if this element had an @XmlRootElement annotation- Parameters:
isXmlRoot
- if the element has an @XmlRootElement
-
isNillable
public boolean isNillable()Return if the global element will be marked as nillable -
setNillable
public void setNillable(boolean nillable) Set if the global element should be marked as nillable -
getJavaType
The javaType associated with this element. Maybe set by the constructor or by setJavaType.- Returns:
- the javaType associated with this element.
-
setJavaType
Set the javaType associated with this element. This will also set the java type name associated with this element to type.getQualifiedName()- Parameters:
type
- the javaType associated with this element.
-
isList
public boolean isList()Return if this element is a list- Returns:
- isList true if the element is a list
-
setList
public void setList(boolean isList) Mark if this element is a list- Parameters:
isList
- true if the element is a list
-
getJavaTypeAdapterClass
Get the java type adapter class associated with the element- Returns:
- the java type adapater class associated with this element. May return null.
-
setJavaTypeAdapterClass
Set the java type adapter class associated with this element if applicable.- Parameters:
javaTypeAdapterClass
- Class of the java type adapter associated with this element.
-
getAdaptedJavaType
Get the adapted java type. Only set when an XmlJavaTypeAdapter is present.- Returns:
- the JavaClass of the adapted java type. May return null.
-
setAdaptedJavaType
Set the adapted java type if there is an XmlJavaTypeAdapter associated with this element This will also set the adaptedJavaTypeName (getAdaptedJavaTypeName)- Parameters:
adaptedJavaType
- set the JavaClass representing the adapted Java type
-
getAdaptedJavaTypeName
Get the adapted java type name. Only set when an XmlJavaTypeAdapter is present. Will be set to adaptedJavaType.getQualifiedName when setAdaptedJavaType is called- Returns:
- the name of the class of the adapted java type. May return null.
-
getScopeClass
Get the scope class associated with this element. By default the scope of this ElementDeclaration will be XmlElementDecl.GLOBAL- Returns:
- the scope class associated with this element
-
setScopeClass
Set the scope class associated with this element. Default setting is XmlElementDecl.GLOBAL- Parameters:
scopeClass
- associated with this element.
-
getDefaultValue
This will be set if XmlElementDecl has a defaultValue specified- Returns:
- the default value associated with this element. May return null.
-
setDefaultValue
Set the default value associated with this element.- Parameters:
value
- the default value that corresponds to this element.
-
getTypeMappingInfo
Get the TypeMappingInfo object if this ElementDeclaration was created from a TypeMappingInfo- Returns:
- the corresponding TypeMappingInfo. May return null.
-
setTypeMappingInfo
Set the TypeMappingInfo object if this ElementDeclaration was created from a TypeMappingInfo- Parameters:
info
- The TypeMappingInfo object used to create this ElementDeclaration
-
getXmlMimeType
Return the mimeType specified on this element.- Returns:
- the mimeType specified on this element. May return null.
-
setXmlMimeType
Set of this element has an XmlMimeType annotation- Parameters:
xmlMimeType
- set the name of the mime type if specified for this element
-
isXmlAttachmentRef
public boolean isXmlAttachmentRef()Return if this element is associated with an XmlAttachmentRef annotation- Returns:
- if this element is associated with an XmlAttachmentRef annotation
-
setXmlAttachmentRef
public void setXmlAttachmentRef(boolean xmlAttachmentRef) Set if there is an XmlAttachmentRef annotations associated with this element.- Parameters:
xmlAttachmentRef
- true if there is an XmlAttachmentRef annotation
-