org.exolab.castor.xml
Interface XMLFieldDescriptor

All Superinterfaces:
FieldDescriptor, NatureExtendable, PropertyHolder
All Known Implementing Classes:
XMLContainerElementFieldDescriptor, XMLFieldDescriptorImpl

public interface XMLFieldDescriptor
extends FieldDescriptor

XML field descriptor. Wraps FieldDescriptor and adds XML-related information, type conversion, and so on.

Version:
$Revision: 7807 $ $Date: 2004-09-17 00:47:41 -0600 (Fri, 17 Sep 2004) $
Author:
Assaf Arkin, Keith Visco, Ralf Joachim

Field Summary
static java.lang.String PROPERTY_XML_LANG
          The xml:lang property.
static java.lang.String PROPERTY_XML_SPACE
          The xml:space property.
 
Method Summary
 java.lang.String getComponentType()
          Returns the component type of this XMLFieldDescriptor instance, if the field described represents a collection of values.
 int getConstructorArgumentIndex()
          Returns the index within the constructor argument array where the value of this field should be.
 java.lang.String getLocationPath()
          Returns the "relative" XML path for the field being described.
 java.lang.String getNameSpacePrefix()
          Return the "suggested" namespace prefix to use when marshaling as XML.
 java.lang.String getNameSpaceURI()
          Returns the namespace URI to be used when marshaling and unmarshaling as XML.
 NodeType getNodeType()
          Returns the node type of the field being described.
 java.lang.String getSchemaType()
          Returns the XML Schema type of the XML field being described.
 java.util.List getSubstitutes()
          Returns the possible substitution groups for this class.
 FieldValidator getValidator()
          Returns a specific validator for the field described by this descriptor.
 java.lang.String getXMLName()
          Returns the XML Name for the field being described.
 java.lang.String getXMLProperty(java.lang.String propertyName)
          Returns the value property with the given name or null if no such property exists.
 boolean isConstructorArgument()
          Returns true if the value of the field represented by this descriptor should be set via the constructor of the containing class.
 boolean isContainer()
          Returns true if the field described by this descriptor is a container field.
 boolean isDerivedFromXSList()
          Indicates whether the field described by this XMLFieldDescriptorImpl is created as a result of a definition.
 boolean isIncremental()
          Returns the incremental flag which when true indicates that this member may be safely added before the unmarshaler is finished unmarshaling it.
 boolean isMapped()
          Returns true if the field described by this descriptor is Map or Hashtable.
 boolean isMultivalued()
          Returns true if the field described by this descriptor can contain more than one value.
 boolean isNillable()
          Returns true if the field described by this descriptor may be nillable.
 boolean isReference()
          Returns true if the field described by this descriptor is a reference (ie.
 boolean matches(java.lang.String xmlName)
          Returns true if this descriptor can be used to handle elements or attributes with the given XML name.
 boolean matches(java.lang.String xmlName, java.lang.String namespace)
          Returns true if this descriptor can be used to handle elements or attributes with the given XML name.
 void setDerivedFromXSList(boolean derivedFromXSList)
          Sets whether the field described by this XMLFieldDescriptorImpl is created as a result of a definition.
 void setSubstitutes(java.util.List substitutes)
          Sets the possible substitution groups for this class.
 
Methods inherited from interface org.exolab.castor.mapping.FieldDescriptor
getClassDescriptor, getContainingClassDescriptor, getFieldName, getFieldType, getHandler, isImmutable, isRequired, isTransient, setContainingClassDescriptor
 
Methods inherited from interface org.castor.core.nature.PropertyHolder
getProperty, setProperty
 
Methods inherited from interface org.castor.core.nature.NatureExtendable
addNature, hasNature
 

Field Detail

PROPERTY_XML_SPACE

static final java.lang.String PROPERTY_XML_SPACE
The xml:space property.

See Also:
Constant Field Values

PROPERTY_XML_LANG

static final java.lang.String PROPERTY_XML_LANG
The xml:lang property.

See Also:
Constant Field Values
Method Detail

getConstructorArgumentIndex

int getConstructorArgumentIndex()
Returns the index within the constructor argument array where the value of this field should be. A value less than zero indicates that the value of this field is set via a normal setter method and not via the constructor.

Note: This only applies to attribute mapped fields at this time.

Returns:
the index within the constructor argument array for this field.
See Also:
isConstructorArgument()

isConstructorArgument

boolean isConstructorArgument()
Returns true if the value of the field represented by this descriptor should be set via the constructor of the containing class. This is only valid for attribute mapped fields.

Returns:
true if the value of the field represented by this descriptor should be set via the constructor of the containing class.

getLocationPath

java.lang.String getLocationPath()
Returns the "relative" XML path for the field being described.

In most cases, this will be null. However sometimes a field may be mapped to a nested element. In which case the value returned by this method should be the nested element name. If more than one level of nesting is needed each nested element name should be separated by by a path separator (forward slash '/').

The location path name is "relative" to the parent Class. The name of the parent must not be included in the path.

For example, give the following two classes:

    class Root {
        Bar bar;
    }

    class Bar {
       String value;
    }
 
And the following XML:
    <root>
       <foo>
          <bar> value of bar </bar>
       </foo>
    </root>
 
Since <foo> has no associated class, the path for 'bar' would be: "foo"

Returns:
The "relative" XML path for the field being described.

getNameSpacePrefix

java.lang.String getNameSpacePrefix()
Return the "suggested" namespace prefix to use when marshaling as XML.

Returns:
the "suggested" namespace prefix.

getNameSpaceURI

java.lang.String getNameSpaceURI()
Returns the namespace URI to be used when marshaling and unmarshaling as XML.

Returns:
the namespace URI.

getNodeType

NodeType getNodeType()
Returns the node type of the field being described. The NodeType represents the type of node that the field will be marshaled into XML as.

Returns:
the NodeType of the Field being described.

getXMLProperty

java.lang.String getXMLProperty(java.lang.String propertyName)
Returns the value property with the given name or null if no such property exists. This method is useful for future evolutions of this interface as well as for user-defined extensions. See class declared properties for built-in properties.

Parameters:
propertyName - the name of the property whose value should be returned.
Returns:
the value of the property, or null.

getSchemaType

java.lang.String getSchemaType()
Returns the XML Schema type of the XML field being described.

Returns:
the XML Schema type of the XML field being described.

getValidator

FieldValidator getValidator()
Returns a specific validator for the field described by this descriptor. A null value may be returned if no specific validator exists.

Returns:
the field validator for the described field

getXMLName

java.lang.String getXMLName()
Returns the XML Name for the field being described.

Returns:
the XML name.

isContainer

boolean isContainer()
Returns true if the field described by this descriptor is a container field. A container is a field that is not a first-class object, and should therefore have no XML representation.

Returns:
true if the field is a container

isIncremental

boolean isIncremental()
Returns the incremental flag which when true indicates that this member may be safely added before the unmarshaler is finished unmarshaling it.

Returns:
true if the Object can safely be added before the unmarshaler is finished unmarshaling the Object.

isMapped

boolean isMapped()
Returns true if the field described by this descriptor is Map or Hashtable. If this method returns true, it must also return true for any call to isMultivalued().

Returns:
true if the field described by this desciptor is a Map or Hashtable, otherwise false.

isMultivalued

boolean isMultivalued()
Returns true if the field described by this descriptor can contain more than one value.

Specified by:
isMultivalued in interface FieldDescriptor
Returns:
true if the field described by this descriptor can contain more than one value

isNillable

boolean isNillable()
Returns true if the field described by this descriptor may be nillable. A nillable field is one that may have empty content and still be valid. Please see the XML Schema 1.0 Recommendation for more information on nillable.

Returns:
true if the field may be nillable.

isReference

boolean isReference()
Returns true if the field described by this descriptor is a reference (ie. IDREF) to another object in the "Object Model" (e.g., XML tree).

Returns:
true if the field described by this descriptor is a reference to another object in the "Object Model"

matches

boolean matches(java.lang.String xmlName)
Returns true if this descriptor can be used to handle elements or attributes with the given XML name. By default this method simply compares the given XML name with the internal XML name. This method can be overridden to provide more complex matching.

Parameters:
xmlName - the XML name to compare
Returns:
true if this descriptor can be used to handle elements or attributes with the given XML name.

matches

boolean matches(java.lang.String xmlName,
                java.lang.String namespace)
Returns true if this descriptor can be used to handle elements or attributes with the given XML name. By default this method simply compares the given XML name with the internal XML name. This method can be overridden to provide more complex matching.

Parameters:
xmlName - the XML name to compare
namespace - the namespace URI
Returns:
true if this descriptor can be used to handle elements or attributes with the given XML name.

getSubstitutes

java.util.List getSubstitutes()
Returns the possible substitution groups for this class.

Returns:
the possible substitution groups for this class.

setSubstitutes

void setSubstitutes(java.util.List substitutes)
Sets the possible substitution groups for this class.

Parameters:
substitutes - Possible substitution groups for this class.

setDerivedFromXSList

void setDerivedFromXSList(boolean derivedFromXSList)
Sets whether the field described by this XMLFieldDescriptorImpl is created as a result of a definition.

Parameters:
derivedFromXSList - A boolean value, true or false.

isDerivedFromXSList

boolean isDerivedFromXSList()
Indicates whether the field described by this XMLFieldDescriptorImpl is created as a result of a definition.

Parameters:
derivedFromXSList - Trueif the field described by this XMLFieldDescriptorImpl is created as a result of a definition. .

getComponentType

java.lang.String getComponentType()
Returns the component type of this XMLFieldDescriptor instance, if the field described represents a collection of values.

Returns:
The collection's component type.
See Also:
getSchemaType()


Copyright © 2011. All Rights Reserved.