This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.xml.bind
class JAXBElement

java.lang.Object extended by javax.xml.bind.JAXBElement
All Implemented Interfaces:
Serializable

public class JAXBElement
extends Object
implements Serializable

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

The declaredType and scope property are the JAXB class binding for the xml type definition.

Scope is either {@link 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.


Nested Class Summary
static class

           Designates global scope for an xml element.
 
Field Summary
protected Class declaredType
          Java datatype binding for xml element declaration's type.
protected QName name
          xml element tag name
protected boolean nil
          true iff the xml element instance has xsi:nil="true".
protected Class scope
          Scope of xml element declaration representing this xml element instance.
protected Object value
          xml element value.
 
Constructor Summary
JAXBElement(QName name, Class declaredType, Class scope, Object value)

          Construct an xml element instance.
JAXBElement(QName name, Class declaredType, Object value)

          Construct an xml element instance.
 
Method Summary
 Class

          Returns the Java binding of the xml element declaration's type attribute.
 QName

          Returns the xml element tag name.
 Class

          Returns scope of xml element declaration.
 Object

          Return the content model and attribute values for this element.
 boolean

          Returns true iff this xml element declaration is global.
 boolean

          Returns true iff this element instance content model is nil.
 boolean

          Returns true iff this xml element instance's value has a different type than xml element declaration's declared type.
 void
setNil(boolean value)

          Set whether this element has nil content.
 void

          Set the content model and attributes of this xml element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

declaredType

protected final Class declaredType
Java datatype binding for xml element declaration's type.

name

protected final QName name
xml element tag name

nil

protected boolean nil
true iff the xml element instance has xsi:nil="true".

scope

protected final Class scope
Scope of xml element declaration representing this xml element instance. Can be one of the following values: - {@link 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 Object value
xml element value. Represents content model and attributes of an xml element instance.
Constructor Detail

JAXBElement

public JAXBElement(QName name,
                   Class declaredType,
                   Class scope,
                   Object value)

Construct an xml element instance.

Parameters:
name - Java binding of xml element tag name
declaredType - Java binding of xml element declaration's type
scope - Java binding of scope of xml element declaration. Passing null is the same as passing GlobalScope.class
value - Java instance representing xml element's value.

JAXBElement

public JAXBElement(QName name,
                   Class declaredType,
                   Object value)
Construct an xml element instance. This is just a convenience method for new JAXBElement(name,declaredType,GlobalScope.class,value)

Parameters:
name
declaredType
value
Method Detail

getDeclaredType

public Class getDeclaredType()
Returns the Java binding of the xml element declaration's type attribute.


getName

public QName getName()
Returns the xml element tag name.


getScope

public Class getScope()
Returns scope of xml element declaration.

Returns:
GlobalScope.class if this element is of global scope.

getValue

public Object getValue()

Return the content model and attribute values for this element.

See {@link #isNil()} for a description of a property constraint when this value is null


isGlobalScope

public boolean isGlobalScope()
Returns true iff this xml element declaration is global.


isNil

public boolean isNil()

Returns true iff this element instance content model is nil.

This property always returns true when {@link #getValue()} is null. Note that the converse is not true, when this property is true, {@link #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()
Returns true iff this xml element instance's value has a different type than xml element declaration's declared type.


setNil

public void setNil(boolean value)

Set whether this element has nil content.

Parameters:
value

setValue

public void setValue(Object t)

Set the content model and attributes of this xml element.

When this property is set to null, isNil() must by true. Details of constraint are described at {@link #isNil()}.

Parameters:
t


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.