JAXB
v0.21

javax.xml.bind
Class PCData

java.lang.Object
  |
  +--javax.xml.bind.ValidatableObject
        |
        +--javax.xml.bind.MarshallableObject
              |
              +--javax.xml.bind.PCData
All Implemented Interfaces:
Comparable

public final class PCData
extends MarshallableObject
implements Comparable

Marshallable-object class for parsed character data.

Instances of this class are used to represent character data occurring in elements with simple character content or mixed content.

An instance of this class must contain character data in order to be valid.

Version:
1.4, 01/05/31

Constructor Summary
PCData()
          Constructs a new instance of this class with no character data.
PCData(String chars)
          Constructs a new instance of this class with the given character data.
 
Method Summary
 String chars()
          Returns the character data in this instance.
 void chars(String chars)
          Changes the character data in this instance.
 int compareTo(Object ob)
          Compares this object to another object.
 boolean equals(Object ob)
          Tells whether or not this object is equal to another.
 String getChars()
          Returns the character data in this instance.
 int hashCode()
          Returns a hash-code value for this object.
 void marshal(Marshaller m)
          Marshals the content of this object, and its children, using the given marshaller (optional operation).
 void setChars(String chars)
          Changes the character data in this instance.
 void unmarshal(Unmarshaller um)
          Unmarshals an element or some character data into this object, converting data as necessary, checking type constraints and local structural constraints, and recording the information required to check global structural constraints.
 void validateThis()
          Ensures that this object does not violate any local structural constraints.
 
Methods inherited from class javax.xml.bind.ValidatableObject
invalidate, validate, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PCData

public PCData()
Constructs a new instance of this class with no character data.

PCData

public PCData(String chars)
Constructs a new instance of this class with the given character data.
Parameters:
chars - The character data for this instance
Method Detail

chars

public String chars()
Returns the character data in this instance.
Returns:
The character data

chars

public void chars(String chars)
Changes the character data in this instance.
Parameters:
chars - The new character data for this instance; may not be null

compareTo

public int compareTo(Object ob)
Compares this object to another object. Two instances of this class are compared by comparing their character data in the manner of the String.compareTo method.
Specified by:
compareTo in interface Comparable
Parameters:
ob - The object with which this object is to be compared
Returns:
A negative integer, a positive integer, or zero as this object is less than, equal to, or greater than the given object
Throws:
ClassCastException - If the given object is not an instance of this class

equals

public boolean equals(Object ob)
Tells whether or not this object is equal to another. Two instances of this class are equal if, and only if, their character data are equal.
Overrides:
equals in class Object
Parameters:
ob - The object with which this object is to be compared
Returns:
true if, and only if, this object is equal to the given object

getChars

public String getChars()
Returns the character data in this instance.
Returns:
The character data

hashCode

public int hashCode()
Returns a hash-code value for this object.
Overrides:
hashCode in class Object
Returns:
A hash-code value

marshal

public void marshal(Marshaller m)
             throws IOException
Description copied from class: MarshallableObject
Marshals the content of this object, and its children, using the given marshaller (optional operation). Requires that the object be valid.

This method must use the given marshaller's XMLWriter to write the content of this object, and it must invoke the given marshaller's marshal(MarshallableObject) method to marshal any children.

As defined in this class, this method throws an UnsupportedOperationException; it should be overridden only by schema-derived classes. This method should only be invoked by the marshalling process; its behavior when invoked in any other manner is unspecified.

Overrides:
marshal in class MarshallableObject
Following copied from class: javax.xml.bind.MarshallableObject
Parameters:
m - The marshaller to be used
Throws:
IOException - If an I/O error occurs
UnsupportedOperationException - If this object does not support marshalling

setChars

public void setChars(String chars)
Changes the character data in this instance.
Parameters:
chars - The new character data for this instance

unmarshal

public void unmarshal(Unmarshaller um)
               throws UnmarshalException
Description copied from class: MarshallableObject
Unmarshals an element or some character data into this object, converting data as necessary, checking type constraints and local structural constraints, and recording the information required to check global structural constraints.

This method must use the given unmarshaller's XMLScanner to parse the elements and attributes represented by this object. It must recursively invoke the given unmarshaller's unmarshal() and unmarshal(Class) methods to unmarshal any subelements. Finally, it must invoke the reference(String, Validator.Patcher) method of the marshaller's validator in order to arrange for the target of each identifier reference to be installed once the reference is resolved.

As defined in this class, this method throws an UnsupportedOperationException; it should be overridden only by schema-derived classes. This method should only be invoked by the unmarshalling process; its behavior when invoked in any other manner is unspecified.

Overrides:
unmarshal in class MarshallableObject
Following copied from class: javax.xml.bind.MarshallableObject
Parameters:
u - The unmarshaller to be used
Throws:
ScanIOException - If an I/O error occurs
ScanException - If the source document is not well-formed
InvalidContentException - If the unmarshaller's scanner is not initially positioned at an appropriate start tag or at some character data, according to whether this object is to represent an element or character data, respectively; or if this object is to represent an element and the element's content specification as described in the source schema is violated
ValidationException - If a type or structural constraint is violated by the input document

validateThis

public void validateThis()
                  throws MissingContentException
Description copied from class: ValidatableObject
Ensures that this object does not violate any local structural constraints. In particular, this method ensures that any required properties have been given values and that the object's children in the content tree, if any, match the content specification of the schema component from which this object's class was derived. This method does not recursively validate this object's children.

The default implementation of this method does nothing; it should be overridden only by schema-derived classes. This method may be invoked outside of the normal validation process.

Overrides:
validateThis in class ValidatableObject
Following copied from class: javax.xml.bind.ValidatableObject
Throws:
EmptyAttributeException - If a collection property derived from a compound attribute is empty, but the source schema requires at least one value
InvalidContentException - If the children of this object violate the content specification of the schema component from which this object's class was derived
MissingAttributeException - If a property derived from a required attribute has no value
MissingContentException - If a property derived from a required content component has no value

JAXB
v0.21


Comments to: jaxb-comments@java.sun.com
More information at: http://java.sun.com/xml/jaxb

Copyright © 2001 by Sun Microsystems, Inc., 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.