Top Description Fields Constructors Methods
org.eclipse.persistence.internal.oxm

public Class Root

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.oxm.XMLRoot
Imports
javax.xml.namespace.QName

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

Modifier and TypeField and Description
protected Class<?>
protected String
protected String
protected String
protected boolean
protected String
protected String
protected Object
protected String
protected QName
protected String

Constructor Summary

AccessConstructor and Description
public
Root()

Default constructor.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public Class<?>

Returns:

the declared type
getDeclaredType
()

Gets the declared type.

public String

Returns:

the encoding
getEncoding
()

Gets the encoding which will be set on the XMLRoot during unmarshal.

public String

Returns:

the local name
getLocalName
()

Gets the local name.

public String

Returns:

the namespace uri
getNamespaceURI
()

Gets the namespace uri.

public String

Returns:

the no namespace schema location
getNoNamespaceSchemaLocation
()

Gets the no namespace schema location which will be set on the XMLRoot during unmarshal.

public Object

Returns:

the object
getObject
()

Gets the object.

public String

Returns:

the schema location
getSchemaLocation
()

Gets the schema location which will be set on the XMLRoot during unmarshal.

public QName

Returns:

the schema type associated with this XMLRoot object or null.
getSchemaType
()

Gets the schema type.

public String

Returns:

the XML version
getXMLVersion
()

Gets the XML version which will be set on the XMLRoot during unmarshal.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public boolean

Returns:

true, if is nil
isNil
()

Checks if is nil.

public void
setDeclaredType(Class<?>
The declared type of this XMLRoot object.
type
)

Sets the declared type.

public void
setEncoding(String
the new encoding
encoding
)

Sets the encoding.

public void
setLocalName(String
the new local name
name
)

Set the element name.

public void
setNamespaceURI(String
the new namespace uri
rootElementUri
)

Sets the namespace uri associated with the QName of this XMLRoot.

public void
setNil(boolean nil)

Sets that this XMLRoot object is nil.

public void
setNoNamespaceSchemaLocation(String
the new no namespace schema location
noNamespaceSchemaLocation
)

Sets the no namespace schema location.

public void
setObject(Object
The object to associate with this XMLRoot.
rootObject
)

Sets the object associated with this XMLRoot.

public void
setSchemaLocation(String
the new schema location
schemaLocation
)

Sets the schema location.

public void
setSchemaType(QName
the new schema type
schemaType
)

Sets the schema type that should be associated with this XMLRoot object.

public void
setVersion(String
the new version
version
)

Sets the version.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

declaredTypeback to summary
protected Class<?> declaredType
encodingback to summary
protected String encoding
localNameback to summary
protected String localName
namespaceUriback to summary
protected String namespaceUri
nilback to summary
protected boolean nil
noNamespaceSchemaLocationback to summary
protected String noNamespaceSchemaLocation
prefixback to summary
protected String prefix
rootObjectback to summary
protected Object rootObject
schemaLocationback to summary
protected String schemaLocation
schemaTypeback to summary
protected QName schemaType
xmlVersionback to summary
protected String xmlVersion

Constructor Detail

Rootback to summary
public Root()

Default constructor.

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getDeclaredTypeback to summary
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:Class<?>

the declared type

getEncodingback to summary
public String getEncoding()

Gets the encoding which will be set on the XMLRoot during unmarshal.

Returns:String

the encoding

getLocalNameback to summary
public String getLocalName()

Gets the local name. This should not be null.

Returns:String

the local name

getNamespaceURIback to summary
public String getNamespaceURI()

Gets the namespace uri. This may be null.

Returns:String

the namespace uri

getNoNamespaceSchemaLocationback to summary
public String getNoNamespaceSchemaLocation()

Gets the no namespace schema location which will be set on the XMLRoot during unmarshal.

Returns:String

the no namespace schema location

getObjectback to summary
public Object getObject()

Gets the object. This may be null.

Returns:Object

the object

getSchemaLocationback to summary
public String getSchemaLocation()

Gets the schema location which will be set on the XMLRoot during unmarshal.

Returns:String

the schema location

getSchemaTypeback to summary
public QName getSchemaType()

Gets the schema type. This schema type will be considering when marshalling XMLRoot objects.

Returns:QName

the schema type associated with this XMLRoot object or null.

getXMLVersionback to summary
public String getXMLVersion()

Gets the XML version which will be set on the XMLRoot during unmarshal.

Returns:String

the XML version

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
isNilback to summary
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:boolean

true, if is nil

setDeclaredTypeback to summary
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:Class<?>

The declared type of this XMLRoot object.

setEncodingback to summary
public void setEncoding(String encoding)

Sets the encoding.

Parameters
encoding:String

the new encoding

setLocalNameback to summary
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:String

the new local name

setNamespaceURIback to summary
public void setNamespaceURI(String rootElementUri)

Sets the namespace uri associated with the QName of this XMLRoot.

Parameters
rootElementUri:String

the new namespace uri

setNilback to summary
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.

setNoNamespaceSchemaLocationback to summary
public void setNoNamespaceSchemaLocation(String noNamespaceSchemaLocation)

Sets the no namespace schema location.

Parameters
noNamespaceSchemaLocation:String

the new no namespace schema location

setObjectback to summary
public void setObject(Object rootObject)

Sets the object associated with this XMLRoot. This may be null.

Parameters
rootObject:Object

The object to associate with this XMLRoot.

setSchemaLocationback to summary
public void setSchemaLocation(String schemaLocation)

Sets the schema location.

Parameters
schemaLocation:String

the new schema location

setSchemaTypeback to summary
public void setSchemaType(QName schemaType)

Sets the schema type that should be associated with this XMLRoot object.

Parameters
schemaType:QName

the new schema type

setVersionback to summary
public void setVersion(String version)

Sets the version.

Parameters
version:String

the new version