Class Root
- java.lang.Object
-
- org.eclipse.persistence.internal.oxm.Root
-
- Direct Known Subclasses:
XMLRoot
public class Root extends java.lang.ObjectRoot 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 java.lang.ClassdeclaredTypeprotected java.lang.Stringencodingprotected java.lang.StringlocalNameprotected java.lang.StringnamespaceUriprotected booleannilprotected java.lang.StringnoNamespaceSchemaLocationprotected java.lang.Stringprefixprotected java.lang.ObjectrootObjectprotected java.lang.StringschemaLocationprotected javax.xml.namespace.QNameschemaTypeprotected java.lang.StringxmlVersion
-
Constructor Summary
Constructors Constructor Description Root()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.lang.ClassgetDeclaredType()Gets the declared type.java.lang.StringgetEncoding()Gets the encoding which will be set on the XMLRoot during unmarshal.java.lang.StringgetLocalName()Gets the local name.java.lang.StringgetNamespaceURI()Gets the namespace uri.java.lang.StringgetNoNamespaceSchemaLocation()Gets the no namespace schema location which will be set on the XMLRoot during unmarshal.java.lang.ObjectgetObject()Gets the object.java.lang.StringgetSchemaLocation()Gets the schema location which will be set on the XMLRoot during unmarshal.javax.xml.namespace.QNamegetSchemaType()Gets the schema type.java.lang.StringgetXMLVersion()Gets the XML version which will be set on the XMLRoot during unmarshal.inthashCode()booleanisNil()Checks if is nil.voidsetDeclaredType(java.lang.Class type)Sets the declared type.voidsetEncoding(java.lang.String encoding)Sets the encoding.voidsetLocalName(java.lang.String name)Set the element name.voidsetNamespaceURI(java.lang.String rootElementUri)Sets the namespace uri associated with the QName of this XMLRoot.voidsetNil(boolean nil)Sets that this XMLRoot object is nil.voidsetNoNamespaceSchemaLocation(java.lang.String noNamespaceSchemaLocation)Sets the no namespace schema location.voidsetObject(java.lang.Object rootObject)Sets the object associated with this XMLRoot.voidsetSchemaLocation(java.lang.String schemaLocation)Sets the schema location.voidsetSchemaType(javax.xml.namespace.QName schemaType)Sets the schema type that should be associated with this XMLRoot object.voidsetVersion(java.lang.String version)Sets the version.
-
-
-
Field Detail
-
rootObject
protected java.lang.Object rootObject
-
localName
protected java.lang.String localName
-
namespaceUri
protected java.lang.String namespaceUri
-
prefix
protected java.lang.String prefix
-
encoding
protected java.lang.String encoding
-
xmlVersion
protected java.lang.String xmlVersion
-
schemaLocation
protected java.lang.String schemaLocation
-
noNamespaceSchemaLocation
protected java.lang.String noNamespaceSchemaLocation
-
schemaType
protected javax.xml.namespace.QName schemaType
-
declaredType
protected java.lang.Class declaredType
-
nil
protected boolean nil
-
-
Method Detail
-
getObject
public java.lang.Object getObject()
Gets the object. This may be null.- Returns:
- the object
-
getLocalName
public java.lang.String getLocalName()
Gets the local name. This should not be null.- Returns:
- the local name
-
getNamespaceURI
public java.lang.String getNamespaceURI()
Gets the namespace uri. This may be null.- Returns:
- the namespace uri
-
setObject
public void setObject(java.lang.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(java.lang.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(java.lang.String rootElementUri)
Sets the namespace uri associated with the QName of this XMLRoot.- Parameters:
rootElementUri- the new namespace uri
-
getEncoding
public java.lang.String getEncoding()
Gets the encoding which will be set on the XMLRoot during unmarshal.- Returns:
- the encoding
-
setEncoding
public void setEncoding(java.lang.String encoding)
Sets the encoding.- Parameters:
encoding- the new encoding
-
getXMLVersion
public java.lang.String getXMLVersion()
Gets the XML version which will be set on the XMLRoot during unmarshal.- Returns:
- the XML version
-
setVersion
public void setVersion(java.lang.String version)
Sets the version.- Parameters:
version- the new version
-
getSchemaLocation
public java.lang.String getSchemaLocation()
Gets the schema location which will be set on the XMLRoot during unmarshal.- Returns:
- the schema location
-
setSchemaLocation
public void setSchemaLocation(java.lang.String schemaLocation)
Sets the schema location.- Parameters:
schemaLocation- the new schema location
-
getNoNamespaceSchemaLocation
public java.lang.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(java.lang.String noNamespaceSchemaLocation)
Sets the no namespace schema location.- Parameters:
noNamespaceSchemaLocation- the new no namespace schema location
-
setSchemaType
public void setSchemaType(javax.xml.namespace.QName schemaType)
Sets the schema type that should be associated with this XMLRoot object.- Parameters:
schemaType- the new schema type
-
getSchemaType
public javax.xml.namespace.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(java.lang.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 java.lang.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.- Parameters:
nil-
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-