| |
|
| java.lang.Object javax.xml.bind.JAXBElement
JAXBElement | public class JAXBElement implements Serializable(Code) | | JAXB representation of an Xml Element.
This class represents information about an Xml Element from both the element
declaration within a schema and the element instance value within an xml document
with the following properties
- element's xml tag name
- value represents the element instance's atttribute(s) and content model
- element declaration's declaredType (xs:element @type attribute)
- scope of element declaration
- boolean nil property. (element instance's xsi:nil attribute)
The declaredType and scope property are the
JAXB class binding for the xml type definition.
Scope is either
GlobalScope or the Java class representing the
complex type definition containing the schema element declaration.
There is a property constraint that if value is null,
then nil must be true. The converse is not true to enable
representing a nil element with attribute(s). If nil is true, it is possible
that value is non-null so it can hold the value of the attributes
associated with a nil element.
author: Kohsuke Kawaguchi, Joe Fialli since: JAXB 2.0 |
Inner Class :final public static class GlobalScope | |
Field Summary | |
final protected Class<T> | declaredType Java datatype binding for xml element declaration's type. | final protected QName | name | protected boolean | nil true iff the xml element instance has xsi:nil="true". | final protected Class | scope Scope of xml element declaration representing this xml element instance.
Can be one of the following values:
-
GlobalScope for global xml element declaration.
- local element declaration has a scope set to the Java class
representation of complex type defintion containing
xml element declaration. | protected T | value xml element value. |
Method Summary | |
public Class<T> | getDeclaredType() Returns the Java binding of the xml element declaration's type attribute. | public QName | getName() Returns the xml element tag name. | public Class | getScope() Returns scope of xml element declaration. | public T | getValue() | public boolean | isGlobalScope() Returns true iff this xml element declaration is global. | public boolean | isNil() Returns true iff this element instance content model
is nil.
This property always returns true when
JAXBElement.getValue() is null.
Note that the converse is not true, when this property is true,
JAXBElement.getValue() can contain a non-null value for attribute(s). | public boolean | isTypeSubstituted() Returns true iff this xml element instance's value has a different
type than xml element declaration's declared type. | public void | setNil(boolean value) | public void | setValue(T t) Set the content model and attributes of this xml element.
When this property is set to null, isNil() must by true. |
declaredType | final protected Class<T> declaredType(Code) | | Java datatype binding for xml element declaration's type.
|
name | final protected QName name(Code) | | xml element tag name
|
nil | protected boolean nil(Code) | | true iff the xml element instance has xsi:nil="true".
|
scope | final protected Class scope(Code) | | Scope of xml element declaration representing this xml element instance.
Can be one of the following values:
-
GlobalScope for global xml element declaration.
- local element declaration has a scope set to the Java class
representation of complex type defintion containing
xml element declaration.
|
value | protected T value(Code) | | xml element value.
Represents content model and attributes of an xml element instance.
|
JAXBElement | public JAXBElement(QName name, Class<T> declaredType, Class scope, T value)(Code) | | Construct an xml element instance.
Parameters: name - Java binding of xml element tag name Parameters: declaredType - Java binding of xml element declaration's type Parameters: scope - Java binding of scope of xml element declaration.Passing null is the same as passing GlobalScope.class Parameters: value - Java instance representing xml element's value. See Also: JAXBElement.getScope() See Also: JAXBElement.isTypeSubstituted() |
JAXBElement | public JAXBElement(QName name, Class<T> declaredType, T value)(Code) | | Construct an xml element instance.
This is just a convenience method for new JAXBElement(name,declaredType,GlobalScope.class,value)
|
getDeclaredType | public Class<T> getDeclaredType()(Code) | | Returns the Java binding of the xml element declaration's type attribute.
|
getName | public QName getName()(Code) | | Returns the xml element tag name.
|
getValue | public T getValue()(Code) | | Return the content model and attribute values for this element.
See
JAXBElement.isNil() for a description of a property constraint when
this value is null
|
isGlobalScope | public boolean isGlobalScope()(Code) | | Returns true iff this xml element declaration is global.
|
isNil | public boolean isNil()(Code) | | Returns true iff this element instance content model
is nil.
This property always returns true when
JAXBElement.getValue() is null.
Note that the converse is not true, when this property is true,
JAXBElement.getValue() can contain a non-null value for attribute(s). It is
valid for a nil xml element to have attribute(s).
|
isTypeSubstituted | public boolean isTypeSubstituted()(Code) | | Returns true iff this xml element instance's value has a different
type than xml element declaration's declared type.
|
|
|
|