Java Doc for JAXBElement.java in  » 6.0-JDK-Core » xml » javax » xml » bind » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » xml » javax.xml.bind 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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  QNamename
    
protected  booleannil
     true iff the xml element instance has xsi:nil="true".
final protected  Classscope
     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  Tvalue
     xml element value.

Constructor Summary
public  JAXBElement(QName name, Class<T> declaredType, Class scope, T value)
    
public  JAXBElement(QName name, Class<T> declaredType, T value)
     Construct an xml element instance.

Method Summary
public  Class<T>getDeclaredType()
     Returns the Java binding of the xml element declaration's type attribute.
public  QNamegetName()
     Returns the xml element tag name.
public  ClassgetScope()
     Returns scope of xml element declaration.
public  TgetValue()
    
public  booleanisGlobalScope()
     Returns true iff this xml element declaration is global.
public  booleanisNil()
    

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  booleanisTypeSubstituted()
     Returns true iff this xml element instance's value has a different type than xml element declaration's declared type.
public  voidsetNil(boolean value)
    
public  voidsetValue(T t)
    

Set the content model and attributes of this xml element.

When this property is set to null, isNil() must by true.


Field Detail
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.




Constructor Detail
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)




Method Detail
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.



getScope
public Class getScope()(Code)
Returns scope of xml element declaration.
See Also:   JAXBElement.isGlobalScope() GlobalScope.class if this element is of global scope.



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.



setNil
public void setNil(boolean value)(Code)

Set whether this element has nil content.


See Also:   JAXBElement.isNil()



setValue
public void setValue(T t)(Code)

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 JAXBElement.isNil() .


See Also:   JAXBElement.isTypeSubstituted()



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.