org.apache.commons.betwixt
Class NodeDescriptor

java.lang.Object
  extended byorg.apache.commons.betwixt.NodeDescriptor
Direct Known Subclasses:
AttributeDescriptor, ElementDescriptor

public class NodeDescriptor
extends java.lang.Object

Common superclass for ElementDescriptor and AttributeDescriptor.

Nodes can have just a local name or they can have a local name, qualified name and a namespace uri.

Version:
$Revision: 1.5 $
Author:
James Strachan

Field Summary
private  java.lang.String localName
          The local name of this node without any namespace prefix
private  java.lang.String propertyName
          The property expression to which this node refers to, or null if it is just a constant
private  java.lang.Class propertyType
          the property type associated with this node, if any
private  java.lang.String qualifiedName
          The qualified name of the xml node associated with this descriptor.
private  java.lang.Class singularPropertyType
          the singular property type (i.e.
private  Expression textExpression
          the expression used to evaluate the text value of this node
private  Updater updater
          the updater used to update the current bean from the text value of this node
private  java.lang.String uri
          The namespace URI of this node
 
Constructor Summary
NodeDescriptor()
          Base constructor
NodeDescriptor(java.lang.String localName)
          Creates a NodeDescriptor with no namespace URI or prefix.
NodeDescriptor(java.lang.String localName, java.lang.String qualifiedName, java.lang.String uri)
          Creates a NodeDescriptor with namespace URI and qualified name
 
Method Summary
 java.lang.String getLocalName()
          Gets the local name, excluding any namespace prefix
 java.lang.String getPropertyName()
          Gets the name of the bean property to which this node refers
 java.lang.Class getPropertyType()
          Gets the type of the bean property associated with this node, if any
 java.lang.String getQualifiedName()
          Gets the qualified name, including any namespace prefix
 java.lang.Class getSingularPropertyType()
          Gets the underlying type ignoring any wrapping a Collection or Array.
 Expression getTextExpression()
          Gets the expression used to evaluate the text value of this node for a particular Context.
 Updater getUpdater()
          Gets the Updater used to update a Context from the text value corresponding to this node in an xml document
 java.lang.String getURI()
          Gets the (xml) namespace URI prefix for this node.
 void setLocalName(java.lang.String localName)
          Sets the local name
 void setPropertyName(java.lang.String propertyName)
          Sets the name of the bean property to which this node refers
 void setPropertyType(java.lang.Class propertyType)
          Sets the type of the bean property associated with this node, if any
 void setQualifiedName(java.lang.String qualifiedName)
          Sets the qualified name
 void setSingularPropertyType(java.lang.Class singularPropertyType)
          Sets the underlying type ignoring any wrapping Collection or Array.
 void setTextExpression(Expression textExpression)
          Sets the expression used to evaluate the text value of this node for a particular Context
 void setUpdater(Updater updater)
          Sets the Updater used to update a Context from the text value corresponding to this node in an xml document
 void setURI(java.lang.String uri)
          Sets the namespace URI that this node belongs to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localName

private java.lang.String localName
The local name of this node without any namespace prefix


qualifiedName

private java.lang.String qualifiedName
The qualified name of the xml node associated with this descriptor.


uri

private java.lang.String uri
The namespace URI of this node


textExpression

private Expression textExpression
the expression used to evaluate the text value of this node


updater

private Updater updater
the updater used to update the current bean from the text value of this node


propertyName

private java.lang.String propertyName
The property expression to which this node refers to, or null if it is just a constant


propertyType

private java.lang.Class propertyType
the property type associated with this node, if any


singularPropertyType

private java.lang.Class singularPropertyType
the singular property type (i.e. the type ignoring the Collection or Array

Constructor Detail

NodeDescriptor

public NodeDescriptor()
Base constructor


NodeDescriptor

public NodeDescriptor(java.lang.String localName)
Creates a NodeDescriptor with no namespace URI or prefix.

Parameters:
localName - the (xml) local name of this node. This will be used to set both qualified and local name for this name.

NodeDescriptor

public NodeDescriptor(java.lang.String localName,
                      java.lang.String qualifiedName,
                      java.lang.String uri)
Creates a NodeDescriptor with namespace URI and qualified name

Parameters:
localName - the (xml) local name of this node
qualifiedName - the (xml) qualified name of this node
uri - the (xml) namespace prefix of this node
Method Detail

getLocalName

public java.lang.String getLocalName()
Gets the local name, excluding any namespace prefix

Returns:
the (xml) local name of this node

setLocalName

public void setLocalName(java.lang.String localName)
Sets the local name

Parameters:
localName - the (xml) local name of this node

getQualifiedName

public java.lang.String getQualifiedName()
Gets the qualified name, including any namespace prefix

Returns:
the (xml) qualified name of this node. This may be null.

setQualifiedName

public void setQualifiedName(java.lang.String qualifiedName)
Sets the qualified name

Parameters:
qualifiedName - the new (xml) qualified name for this node

getURI

public java.lang.String getURI()
Gets the (xml) namespace URI prefix for this node.

Returns:
the namespace URI that this node belongs to or "" if there is no namespace defined

setURI

public void setURI(java.lang.String uri)
Sets the namespace URI that this node belongs to.

Parameters:
uri - the new namespace uri for this node

getTextExpression

public Expression getTextExpression()
Gets the expression used to evaluate the text value of this node for a particular Context.

Returns:
the expression used to evaluate the text value of this node

setTextExpression

public void setTextExpression(Expression textExpression)
Sets the expression used to evaluate the text value of this node for a particular Context

Parameters:
textExpression - the Expression to be used to evaluate the value of this node

getUpdater

public Updater getUpdater()
Gets the Updater used to update a Context from the text value corresponding to this node in an xml document

Returns:
the Update that should be used to update the value of this node

setUpdater

public void setUpdater(Updater updater)
Sets the Updater used to update a Context from the text value corresponding to this node in an xml document

Parameters:
updater - the Updater to be used to update the values of this node

getPropertyType

public java.lang.Class getPropertyType()
Gets the type of the bean property associated with this node, if any

Returns:
the property type associated with this node, if any

setPropertyType

public void setPropertyType(java.lang.Class propertyType)
Sets the type of the bean property associated with this node, if any

Parameters:
propertyType - the Class of the bean property

getPropertyName

public java.lang.String getPropertyName()
Gets the name of the bean property to which this node refers

Returns:
the name of the bean property to which this node refers to, or null if it is just a constant

setPropertyName

public void setPropertyName(java.lang.String propertyName)
Sets the name of the bean property to which this node refers

Parameters:
propertyName - the name of the bean property. Or null, if this node is not mapped to to a bean property

getSingularPropertyType

public java.lang.Class getSingularPropertyType()
Gets the underlying type ignoring any wrapping a Collection or Array.

Returns:
if this property is a 1-N relationship then this returns the type of a single property value.

setSingularPropertyType

public void setSingularPropertyType(java.lang.Class singularPropertyType)
Sets the underlying type ignoring any wrapping Collection or Array.

Parameters:
singularPropertyType - the Class of the items in the Collection or Array. If node is associated with a collective bean property, then this should not be null.