- java.lang.Object
-
- org.eclipse.persistence.internal.oxm.Root
-
- Direct Known Subclasses:
XMLRoot
public class Root extends Object
Root is used to hold an Object along with the corresponding QName and some other related information. Typically this is used when the object is marshalled/unmarshalled to a QName other than the defaultRootElement set on the Descriptor.
Root objects can be returned from Unmarshaller unmarshal operations and can be given to Marshaller.marshal operations. They may also be in values returned by AnyCollectionMappings and AnyObjectMappings.
-
-
Field Summary
Fields Modifier and Type Field Description protected Class<?>declaredTypeprotected Stringencodingprotected StringlocalNameprotected StringnamespaceUriprotected booleannilprotected StringnoNamespaceSchemaLocationprotected Stringprefixprotected ObjectrootObjectprotected StringschemaLocationprotected QNameschemaTypeprotected StringxmlVersion
-
Constructor Summary
Constructors Constructor Description Root()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)Class<?>getDeclaredType()Gets the declared type.StringgetEncoding()Gets the encoding which will be set on the XMLRoot during unmarshal.StringgetLocalName()Gets the local name.StringgetNamespaceURI()Gets the namespace uri.StringgetNoNamespaceSchemaLocation()Gets the no namespace schema location which will be set on the XMLRoot during unmarshal.ObjectgetObject()Gets the object.StringgetSchemaLocation()Gets the schema location which will be set on the XMLRoot during unmarshal.QNamegetSchemaType()Gets the schema type.StringgetXMLVersion()Gets the XML version which will be set on the XMLRoot during unmarshal.inthashCode()booleanisNil()Checks if is nil.voidsetDeclaredType(Class<?> type)Sets the declared type.voidsetEncoding(String encoding)Sets the encoding.voidsetLocalName(String name)Set the element name.voidsetNamespaceURI(String rootElementUri)Sets the namespace uri associated with the QName of this XMLRoot.voidsetNil(boolean nil)Sets that this XMLRoot object is nil.voidsetNoNamespaceSchemaLocation(String noNamespaceSchemaLocation)Sets the no namespace schema location.voidsetObject(Object rootObject)Sets the object associated with this XMLRoot.voidsetSchemaLocation(String schemaLocation)Sets the schema location.voidsetSchemaType(QName schemaType)Sets the schema type that should be associated with this XMLRoot object.voidsetVersion(String version)Sets the version.
-
-
-
Field Detail
-
rootObject
protected Object rootObject
-
localName
protected String localName
-
namespaceUri
protected String namespaceUri
-
prefix
protected String prefix
-
encoding
protected String encoding
-
xmlVersion
protected String xmlVersion
-
schemaLocation
protected String schemaLocation
-
noNamespaceSchemaLocation
protected String noNamespaceSchemaLocation
-
schemaType
protected QName schemaType
-
declaredType
protected Class<?> declaredType
-
nil
protected boolean nil
-
-
Method Detail
-
getObject
public Object getObject()
Gets the object. This may be null.- Returns:
- the object
-
getLocalName
public String getLocalName()
Gets the local name. This should not be null.- Returns:
- the local name
-
getNamespaceURI
public String getNamespaceURI()
Gets the namespace uri. This may be null.- Returns:
- the namespace uri
-
setObject
public void setObject(Object rootObject)
Sets the object associated with this XMLRoot. This may be null.- Parameters:
rootObject- The object to associate with this XMLRoot.
-
setLocalName
public void setLocalName(String name)
Set the element name. This method will parse the qualified name in an attempt to set the localName fields. ie: this could be set to "someLocalName" or "somePrefix:someLocalName"- Parameters:
name- the new local name
-
setNamespaceURI
public void setNamespaceURI(String rootElementUri)
Sets the namespace uri associated with the QName of this XMLRoot.- Parameters:
rootElementUri- the new namespace uri
-
getEncoding
public String getEncoding()
Gets the encoding which will be set on the XMLRoot during unmarshal.- Returns:
- the encoding
-
setEncoding
public void setEncoding(String encoding)
Sets the encoding.- Parameters:
encoding- the new encoding
-
getXMLVersion
public String getXMLVersion()
Gets the XML version which will be set on the XMLRoot during unmarshal.- Returns:
- the XML version
-
setVersion
public void setVersion(String version)
Sets the version.- Parameters:
version- the new version
-
getSchemaLocation
public String getSchemaLocation()
Gets the schema location which will be set on the XMLRoot during unmarshal.- Returns:
- the schema location
-
setSchemaLocation
public void setSchemaLocation(String schemaLocation)
Sets the schema location.- Parameters:
schemaLocation- the new schema location
-
getNoNamespaceSchemaLocation
public String getNoNamespaceSchemaLocation()
Gets the no namespace schema location which will be set on the XMLRoot during unmarshal.- Returns:
- the no namespace schema location
-
setNoNamespaceSchemaLocation
public void setNoNamespaceSchemaLocation(String noNamespaceSchemaLocation)
Sets the no namespace schema location.- Parameters:
noNamespaceSchemaLocation- the new no namespace schema location
-
setSchemaType
public void setSchemaType(QName schemaType)
Sets the schema type that should be associated with this XMLRoot object.- Parameters:
schemaType- the new schema type
-
getSchemaType
public QName getSchemaType()
Gets the schema type. This schema type will be considering when marshalling XMLRoot objects.- Returns:
- the schema type associated with this XMLRoot object or null.
-
setDeclaredType
public void setDeclaredType(Class<?> type)
Sets the declared type. This may be different than the getObject().getClass(), for example, in the case where inheritance is used the declared type may be the super class and the actual object could be a subclass.- Parameters:
type- The declared type of this XMLRoot object.
-
getDeclaredType
public Class<?> getDeclaredType()
Gets the declared type. This may be different than the getObject().getClass(), for example, in the case where inheritance is used the declared type may be the super class and the actual object could be a subclass.- Returns:
- the declared type
-
isNil
public boolean isNil()
Checks if is nil. Returns true if this XMLRoot has been explicitly set to nil or if xmlRoot.getObject() is null.- Returns:
- true, if is nil
-
setNil
public void setNil(boolean nil)
Sets that this XMLRoot object is nil. If setNil(true) is explicitly called then isNil() will return true even if rootObject is not null.
-
-