org.exolab.castor.mapping.loader
Class FieldDescriptorImpl

java.lang.Object
  extended by org.exolab.castor.mapping.loader.FieldDescriptorImpl
All Implemented Interfaces:
NatureExtendable, PropertyHolder, FieldDescriptor
Direct Known Subclasses:
XMLFieldDescriptorImpl

public class FieldDescriptorImpl
extends java.lang.Object
implements FieldDescriptor


Constructor Summary
protected FieldDescriptorImpl()
          Creates a default instance of a field descriptor.
  FieldDescriptorImpl(java.lang.String fieldName, TypeInfo typeInfo, FieldHandler handler, boolean isTransitive)
          Constructs a new field descriptor.
 
Method Summary
 void addNature(java.lang.String nature)
          Adds a specified nature.
 ClassDescriptor getClassDescriptor()
          Returns the class descriptor related to the field type.
 FieldMappingCollectionType getCollection()
           
 java.lang.String getComparator()
           
 ClassDescriptor getContainingClassDescriptor()
          Get the class descriptor which contains this field.
 java.lang.String getCreateMethod()
           
 java.lang.String getFieldName()
          Returns the name of the field.
 java.lang.Class<?> getFieldType()
          Returns the Java type of the field.
 java.lang.String getGetMethod()
           
 FieldHandler getHandler()
          Returns the handler of the field.
 java.lang.Object getProperty(java.lang.String name)
          Get a property by its name.
 java.lang.String getSetMethod()
           
 boolean hasNature(java.lang.String nature)
          Checks if a specified nature has been added.
 boolean isDirect()
           
 boolean isIdentity()
          Is the described field is part of the identity of the class it belongs to?
 boolean isImmutable()
          Returns true if the field type is immutable.
 boolean isLazy()
           
 boolean isMultivalued()
          Returns true if the field is multivalued (a collection).
 boolean isRequired()
          Returns true if the field type is required.
 boolean isTransient()
          Returns true if the field is transient.
 void setClassDescriptor(ClassDescriptor classDescriptor)
          Set the ClassDescriptor for the described field.
 void setCollection(FieldMappingCollectionType collection)
           
 void setComparator(java.lang.String comparator)
           
 void setContainingClassDescriptor(ClassDescriptor parent)
          Set the class descriptor which contains this field.
 void setCreateMethod(java.lang.String createMethod)
           
 void setDirect(boolean direct)
           
 void setFieldName(java.lang.String fieldName)
          Set the name of the field.
 void setFieldType(java.lang.Class<?> fieldType)
          Set the type of the field.
 void setGetMethod(java.lang.String getMethod)
           
 void setHandler(FieldHandler handler)
          Set the FieldHandler for the field being described by this FieldDescriptor.
 void setIdentity(boolean identity)
          Set wether the described field is part of the identity of the class it belongs to.
 void setImmutable(boolean immutable)
          Set the immutable flag which indicates that changes to this Field result in a new Object to be created, such as java.lang.String.
 void setLazy(boolean lazy)
           
 void setMultivalued(boolean multivalued)
          Set wheter the object described by this descriptor is multivalued or not.
 void setProperty(java.lang.String name, java.lang.Object value)
          Set a property specified by the name to the passed value.
 void setRequired(boolean required)
          Set whether or not the described field is required.
 void setSetMethod(java.lang.String setMethod)
           
 void setTransient(boolean isTransient)
          Sets whether or not the describled field is 'transient'.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FieldDescriptorImpl

protected FieldDescriptorImpl()
Creates a default instance of a field descriptor.


FieldDescriptorImpl

public FieldDescriptorImpl(java.lang.String fieldName,
                           TypeInfo typeInfo,
                           FieldHandler handler,
                           boolean isTransitive)
Constructs a new field descriptor.

Parameters:
fieldName - The field name
typeInfo - The field type information
handler - The field handler (may be null)
isTransitive - True if the field is transient
Method Detail

setContainingClassDescriptor

public final void setContainingClassDescriptor(ClassDescriptor parent)
Description copied from interface: FieldDescriptor
Set the class descriptor which contains this field.

Specified by:
setContainingClassDescriptor in interface FieldDescriptor
Parameters:
parent - The class descriptor which contains this field.
See Also:
{@inheritDoc}

getContainingClassDescriptor

public final ClassDescriptor getContainingClassDescriptor()
Description copied from interface: FieldDescriptor
Get the class descriptor which contains this field.

Specified by:
getContainingClassDescriptor in interface FieldDescriptor
Returns:
The class descriptor which contains this field.
See Also:
{@inheritDoc}

setFieldName

public final void setFieldName(java.lang.String fieldName)
Set the name of the field.

Parameters:
fieldName - Field name.

getFieldName

public final java.lang.String getFieldName()
Description copied from interface: FieldDescriptor
Returns the name of the field. The field must have a name, even if set through accessor methods.

Specified by:
getFieldName in interface FieldDescriptor
Returns:
Field name.
See Also:
{@inheritDoc}

setFieldType

public final void setFieldType(java.lang.Class<?> fieldType)
Set the type of the field.

Parameters:
fieldType - Field type.

getFieldType

public final java.lang.Class<?> getFieldType()
Description copied from interface: FieldDescriptor
Returns the Java type of the field.

Specified by:
getFieldType in interface FieldDescriptor
Returns:
Field type.
See Also:
{@inheritDoc}

setClassDescriptor

public final void setClassDescriptor(ClassDescriptor classDescriptor)
Set the ClassDescriptor for the described field.

Parameters:
classDescriptor - The ClassDescriptor for the described field.

getClassDescriptor

public final ClassDescriptor getClassDescriptor()
Description copied from interface: FieldDescriptor
Returns the class descriptor related to the field type. If the field type is a class for which a descriptor exists, this descriptor is returned. If the field type is a class for which no mapping is provided, null is returned.

Specified by:
getClassDescriptor in interface FieldDescriptor
Returns:
The class descriptor of the field type, or null.
See Also:
{@inheritDoc}

setHandler

public final void setHandler(FieldHandler handler)
Set the FieldHandler for the field being described by this FieldDescriptor.

Parameters:
handler - The FieldHandler for the field being described.

getHandler

public final FieldHandler getHandler()
Description copied from interface: FieldDescriptor
Returns the handler of the field. In order to persist or marshal a field descriptor will be associated with a handler.

Specified by:
getHandler in interface FieldDescriptor
Returns:
The field handler.
See Also:
{@inheritDoc}

setTransient

public final void setTransient(boolean isTransient)
Sets whether or not the describled field is 'transient'.

Parameters:
isTransient - The flag indicating if the described field is 'transient'.

isTransient

public final boolean isTransient()
Description copied from interface: FieldDescriptor
Returns true if the field is transient. Transient fields are never persisted or marshalled.

Specified by:
isTransient in interface FieldDescriptor
Returns:
True if transient field.
See Also:
{@inheritDoc}

setImmutable

public final void setImmutable(boolean immutable)
Set the immutable flag which indicates that changes to this Field result in a new Object to be created, such as java.lang.String. It serves to identify fields which should not be constructed until all the data is available.

Parameters:
immutable - Flag which if true indicates that the field is immutable.

isImmutable

public final boolean isImmutable()
Description copied from interface: FieldDescriptor
Returns true if the field type is immutable.

Specified by:
isImmutable in interface FieldDescriptor
Returns:
True if the field type is immutable.
See Also:
{@inheritDoc}

setRequired

public final void setRequired(boolean required)
Set whether or not the described field is required.

Parameters:
required - The flag indicating whether or not the described field is required.

isRequired

public final boolean isRequired()
Description copied from interface: FieldDescriptor
Returns true if the field type is required.

Specified by:
isRequired in interface FieldDescriptor
Returns:
True if the field type is required.
See Also:
{@inheritDoc}

setMultivalued

public final void setMultivalued(boolean multivalued)
Set wheter the object described by this descriptor is multivalued or not.

Parameters:
multivalued - True if the object described by this descriptor is multivalued.

isMultivalued

public final boolean isMultivalued()
Description copied from interface: FieldDescriptor
Returns true if the field is multivalued (a collection).

Specified by:
isMultivalued in interface FieldDescriptor
Returns:
True if the field is multivalued.
See Also:
{@inheritDoc}

setIdentity

public final void setIdentity(boolean identity)
Set wether the described field is part of the identity of the class it belongs to.

Parameters:
identity - true if field is part of the classes identity.

isIdentity

public final boolean isIdentity()
Is the described field is part of the identity of the class it belongs to?

Returns:
true if field is part of the classes identity.

getProperty

public java.lang.Object getProperty(java.lang.String name)
Description copied from interface: PropertyHolder
Get a property by its name.

Specified by:
getProperty in interface PropertyHolder
Parameters:
name - of the property
Returns:
value of the property
See Also:
getProperty(java.lang.String)

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Description copied from interface: PropertyHolder
Set a property specified by the name to the passed value.

Specified by:
setProperty in interface PropertyHolder
Parameters:
name - of the property
value - of the property
See Also:
setProperty(java.lang.String, java.lang.Object)

addNature

public void addNature(java.lang.String nature)
Description copied from interface: NatureExtendable
Adds a specified nature.

Specified by:
addNature in interface NatureExtendable
Parameters:
nature - ID of the Nature
See Also:
addNature(java.lang.String)

hasNature

public boolean hasNature(java.lang.String nature)
Description copied from interface: NatureExtendable
Checks if a specified nature has been added.

Specified by:
hasNature in interface NatureExtendable
Parameters:
nature - ID of the Nature
Returns:
true if the Nature ID was added.
See Also:
hasNature(java.lang.String)

getComparator

public java.lang.String getComparator()

setComparator

public void setComparator(java.lang.String comparator)

getCollection

public FieldMappingCollectionType getCollection()

setCollection

public void setCollection(FieldMappingCollectionType collection)

isDirect

public boolean isDirect()

setDirect

public void setDirect(boolean direct)

getGetMethod

public java.lang.String getGetMethod()

setGetMethod

public void setGetMethod(java.lang.String getMethod)

getSetMethod

public java.lang.String getSetMethod()

setSetMethod

public void setSetMethod(java.lang.String setMethod)

getCreateMethod

public java.lang.String getCreateMethod()

setCreateMethod

public void setCreateMethod(java.lang.String createMethod)

isLazy

public boolean isLazy()

setLazy

public void setLazy(boolean lazy)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com