Class Root

  • Direct Known Subclasses:
    XMLRoot

    public class Root
    extends java.lang.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.

    • Constructor Summary

      Constructors 
      Constructor Description
      Root()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      java.lang.Class getDeclaredType()
      Gets the declared type.
      java.lang.String getEncoding()
      Gets the encoding which will be set on the XMLRoot during unmarshal.
      java.lang.String getLocalName()
      Gets the local name.
      java.lang.String getNamespaceURI()
      Gets the namespace uri.
      java.lang.String getNoNamespaceSchemaLocation()
      Gets the no namespace schema location which will be set on the XMLRoot during unmarshal.
      java.lang.Object getObject()
      Gets the object.
      java.lang.String getSchemaLocation()
      Gets the schema location which will be set on the XMLRoot during unmarshal.
      javax.xml.namespace.QName getSchemaType()
      Gets the schema type.
      java.lang.String getXMLVersion()
      Gets the XML version which will be set on the XMLRoot during unmarshal.
      int hashCode()  
      boolean isNil()
      Checks if is nil.
      void setDeclaredType​(java.lang.Class type)
      Sets the declared type.
      void setEncoding​(java.lang.String encoding)
      Sets the encoding.
      void setLocalName​(java.lang.String name)
      Set the element name.
      void setNamespaceURI​(java.lang.String rootElementUri)
      Sets the namespace uri associated with the QName of this XMLRoot.
      void setNil​(boolean nil)
      Sets that this XMLRoot object is nil.
      void setNoNamespaceSchemaLocation​(java.lang.String noNamespaceSchemaLocation)
      Sets the no namespace schema location.
      void setObject​(java.lang.Object rootObject)
      Sets the object associated with this XMLRoot.
      void setSchemaLocation​(java.lang.String schemaLocation)
      Sets the schema location.
      void setSchemaType​(javax.xml.namespace.QName schemaType)
      Sets the schema type that should be associated with this XMLRoot object.
      void setVersion​(java.lang.String version)
      Sets the version.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • 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
    • Constructor Detail

      • Root

        public Root()
    • 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:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object