EclipseLink 2.4.2, build 'v20130514-5956486' API Reference

org.eclipse.persistence.jaxb.compiler
Class ElementDeclaration

java.lang.Object
  extended by org.eclipse.persistence.jaxb.compiler.ElementDeclaration

public class ElementDeclaration
extends java.lang.Object

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
ElementDeclaration(javax.xml.namespace.QName name, JavaClass javaType, java.lang.String javaTypeName, boolean isList)
          Create a new ElementDeclaration.
ElementDeclaration(javax.xml.namespace.QName name, JavaClass javaType, java.lang.String javaTypeName, boolean isList, java.lang.Class scopeClass)
          Create a new ElementDeclaration and set the scope.
 
Method Summary
 void addSubstitutableElement(ElementDeclaration element)
          Add an element to the list of elements which can be substituted for this element (ie: has this element in their substitutionGroup)
 JavaClass getAdaptedJavaType()
          Get the adapted java type.
 java.lang.String getAdaptedJavaTypeName()
          Get the adapted java type name.
 java.lang.String getDefaultValue()
          This will be set if XmlElementDecl has a defaultValue specified
 javax.xml.namespace.QName getElementName()
          Get the QName representing this element
 JavaClass getJavaType()
          The javaType associated with this element.
 java.lang.Class getJavaTypeAdapterClass()
          Get the java type adapter class associated with the element
 java.lang.String getJavaTypeName()
          Get the name of the java type associated with this global element.
 java.lang.Class getScopeClass()
          Get the scope class associated with this element.
 java.util.List<ElementDeclaration> getSubstitutableElements()
          The list of elements which can be substituted for this element (ie: has this element in their substitutionGroup)
 javax.xml.namespace.QName getSubstitutionHead()
          If this element has a substitutionGroup this will be set.
 TypeMappingInfo getTypeMappingInfo()
          Get the TypeMappingInfo object if this ElementDeclaration was created from a TypeMappingInfo
 java.lang.String getXmlMimeType()
          Return the mimeType specified on this element.
 boolean isList()
          Return if this element is a list
 boolean isNillable()
          Return if the global element will be marked as nillable
 boolean isXmlAttachmentRef()
          Return if this element is associated with an XmlAttachmentRef annotation
 boolean isXmlRootElement()
          Track if this element had an @XmlRootElement annotation
 void 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(java.lang.String value)
          Set the default value associated with this element.
 void setIsXmlRootElement(boolean isXmlRoot)
          Mark if this element had an @XmlRootElement annotation
 void setJavaType(JavaClass type)
          Set the javaType associated with this element.
 void setJavaTypeAdapterClass(java.lang.Class javaTypeAdapterClass)
          Set the java type adapter class associated with this element if applicable.
 void setList(boolean isList)
          Mark if this element is a list
 void setNillable(boolean nillable)
          Set if the global element should be marked as nillable
 void setScopeClass(java.lang.Class scopeClass)
          Set the scope class associated with this element.
 void setSubstitutionHead(javax.xml.namespace.QName rootElement)
          If this element has a substitutionGroup this will be set.
 void setTypeMappingInfo(TypeMappingInfo info)
          Set the TypeMappingInfo object if this ElementDeclaration was created from a TypeMappingInfo
 void setXmlAttachmentRef(boolean xmlAttachmentRef)
          Set if there is an XmlAttachmentRef annotations associated with this element.
 void setXmlMimeType(java.lang.String xmlMimeType)
          Set of this element has an XmlMimeType annotation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementDeclaration

public ElementDeclaration(javax.xml.namespace.QName name,
                          JavaClass javaType,
                          java.lang.String javaTypeName,
                          boolean isList)
Create a new ElementDeclaration. By default the scope of this ElementDeclaration will be XmlElementDecl.GLOBAL

Parameters:
name - The QName of this element
javaType - The JavaClass of this element
javaTypeName - The String name of the javaType
isList - A boolean representing if this corresponds to an xsd:list

ElementDeclaration

public ElementDeclaration(javax.xml.namespace.QName name,
                          JavaClass javaType,
                          java.lang.String javaTypeName,
                          boolean isList,
                          java.lang.Class scopeClass)
Create a new ElementDeclaration and set the scope.

Parameters:
name - The QName of this element
javaType - The JavaClass of this element
javaTypeName - The String name of the javaType
isList - A boolean representing if this corresponds to an xsd:list
scopeClass - The class representing the scope of this element
Method Detail

getElementName

public javax.xml.namespace.QName getElementName()
Get the QName representing this element

Returns:
the QName associated with this element.

getJavaTypeName

public java.lang.String 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

public java.util.List<ElementDeclaration> 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

public void addSubstitutableElement(ElementDeclaration element)
Add an element to the list of elements which can be substituted for this element (ie: has this element in their substitutionGroup)


setSubstitutionHead

public void setSubstitutionHead(javax.xml.namespace.QName rootElement)
If this element has a substitutionGroup this will be set.

Parameters:
rootElement - the QName value of the substitutionGroup

getSubstitutionHead

public javax.xml.namespace.QName 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

Returns:

setNillable

public void setNillable(boolean nillable)
Set if the global element should be marked as nillable

Parameters:
nillable -

getJavaType

public JavaClass getJavaType()
The javaType associated with this element. Maybe set by the constructor or by setJavaType.

Returns:
the javaType associated with this element.

setJavaType

public void setJavaType(JavaClass type)
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

public java.lang.Class 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

public void setJavaTypeAdapterClass(java.lang.Class javaTypeAdapterClass)
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

public JavaClass 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

public void setAdaptedJavaType(JavaClass adaptedJavaType)
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

public java.lang.String 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

public java.lang.Class 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

public void setScopeClass(java.lang.Class scopeClass)
Set the scope class associated with this element. Default setting is XmlElementDecl.GLOBAL

Parameters:
scopeClass - associated with this element.

getDefaultValue

public java.lang.String getDefaultValue()
This will be set if XmlElementDecl has a defaultValue specified

Returns:
the default value associated with this element. May return null.

setDefaultValue

public void setDefaultValue(java.lang.String value)
Set the default value associated with this element.

Parameters:
value - the default value that corresponds to this element.

getTypeMappingInfo

public TypeMappingInfo getTypeMappingInfo()
Get the TypeMappingInfo object if this ElementDeclaration was created from a TypeMappingInfo

Returns:
the corresponding TypeMappingInfo. May return null.

setTypeMappingInfo

public void setTypeMappingInfo(TypeMappingInfo info)
Set the TypeMappingInfo object if this ElementDeclaration was created from a TypeMappingInfo

Parameters:
The - TypeMappingInfo object used to create this ElementDeclaration

getXmlMimeType

public java.lang.String getXmlMimeType()
Return the mimeType specified on this element.

Returns:
the mimeType specified on this element. May return null.

setXmlMimeType

public void setXmlMimeType(java.lang.String xmlMimeType)
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

EclipseLink 2.4.2, build 'v20130514-5956486' API Reference