Package org.exolab.castor.mapping.loader
Class FieldDescriptorImpl
java.lang.Object
org.exolab.castor.mapping.loader.FieldDescriptorImpl
- All Implemented Interfaces:
NatureExtendable,PropertyHolder,FieldDescriptor
- Direct Known Subclasses:
XMLFieldDescriptorImpl
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a default instance of a field descriptor.FieldDescriptorImpl(String fieldName, TypeInfo typeInfo, FieldHandler handler, boolean isTransitive) Constructs a new field descriptor. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a specified nature.final ClassDescriptorReturns the class descriptor related to the field type.final ClassDescriptorGet the class descriptor which contains this field.final StringReturns the name of the field.final Class<?> Returns the Java type of the field.final FieldHandlerReturns the handler of the field.getProperty(String name) Get a property by its name.booleanChecks if a specified nature has been added.booleanisDirect()final booleanIs the described field is part of the identity of the class it belongs to?final booleanReturns true if the field type is immutable.booleanisLazy()final booleanReturns true if the field is multivalued (a collection).final booleanReturns true if the field type is required.final booleanReturns true if the field is transient.final voidsetClassDescriptor(ClassDescriptor classDescriptor) Set the ClassDescriptor for the described field.voidsetCollection(FieldMappingCollectionType collection) voidsetComparator(String comparator) final voidSet the class descriptor which contains this field.voidsetCreateMethod(String createMethod) voidsetDirect(boolean direct) final voidsetFieldName(String fieldName) Set the name of the field.final voidsetFieldType(Class<?> fieldType) Set the type of the field.voidsetGetMethod(String getMethod) final voidsetHandler(FieldHandler handler) Set the FieldHandler for the field being described by this FieldDescriptor.final voidsetIdentity(boolean identity) Set wether the described field is part of the identity of the class it belongs to.final voidsetImmutable(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.voidsetLazy(boolean lazy) final voidsetMultivalued(boolean multivalued) Set wheter the object described by this descriptor is multivalued or not.voidsetProperty(String name, Object value) Set a property specified by the name to the passed value.final voidsetRequired(boolean required) Set whether or not the described field is required.voidsetSetMethod(String setMethod) final voidsetTransient(boolean isTransient) Sets whether or not the describled field is 'transient'.toString()
-
Constructor Details
-
FieldDescriptorImpl
protected FieldDescriptorImpl()Creates a default instance of a field descriptor. -
FieldDescriptorImpl
public FieldDescriptorImpl(String fieldName, TypeInfo typeInfo, FieldHandler handler, boolean isTransitive) Constructs a new field descriptor.- Parameters:
fieldName- The field nametypeInfo- The field type informationhandler- The field handler (may be null)isTransitive- True if the field is transient
-
-
Method Details
-
setContainingClassDescriptor
Description copied from interface:FieldDescriptorSet the class descriptor which contains this field.- Specified by:
setContainingClassDescriptorin interfaceFieldDescriptor- Parameters:
parent- The class descriptor which contains this field.- See Also:
-
getContainingClassDescriptor
Description copied from interface:FieldDescriptorGet the class descriptor which contains this field.- Specified by:
getContainingClassDescriptorin interfaceFieldDescriptor- Returns:
- The class descriptor which contains this field.
- See Also:
-
setFieldName
Set the name of the field.- Parameters:
fieldName- Field name.
-
getFieldName
Description copied from interface:FieldDescriptorReturns the name of the field. The field must have a name, even if set through accessor methods.- Specified by:
getFieldNamein interfaceFieldDescriptor- Returns:
- Field name.
- See Also:
-
setFieldType
Set the type of the field.- Parameters:
fieldType- Field type.
-
getFieldType
Description copied from interface:FieldDescriptorReturns the Java type of the field.- Specified by:
getFieldTypein interfaceFieldDescriptor- Returns:
- Field type.
- See Also:
-
setClassDescriptor
Set the ClassDescriptor for the described field.- Parameters:
classDescriptor- The ClassDescriptor for the described field.
-
getClassDescriptor
Description copied from interface:FieldDescriptorReturns 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:
getClassDescriptorin interfaceFieldDescriptor- Returns:
- The class descriptor of the field type, or null.
- See Also:
-
setHandler
Set the FieldHandler for the field being described by this FieldDescriptor.- Parameters:
handler- The FieldHandler for the field being described.
-
getHandler
Description copied from interface:FieldDescriptorReturns the handler of the field. In order to persist or marshal a field descriptor will be associated with a handler.- Specified by:
getHandlerin interfaceFieldDescriptor- Returns:
- The field handler.
- See Also:
-
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:FieldDescriptorReturns true if the field is transient. Transient fields are never persisted or marshalled.- Specified by:
isTransientin interfaceFieldDescriptor- Returns:
- True if transient field.
- See Also:
-
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:FieldDescriptorReturns true if the field type is immutable.- Specified by:
isImmutablein interfaceFieldDescriptor- Returns:
- True if the field type is immutable.
- See Also:
-
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:FieldDescriptorReturns true if the field type is required.- Specified by:
isRequiredin interfaceFieldDescriptor- Returns:
- True if the field type is required.
- See Also:
-
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:FieldDescriptorReturns true if the field is multivalued (a collection).- Specified by:
isMultivaluedin interfaceFieldDescriptor- Returns:
- True if the field is multivalued.
- See Also:
-
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-trueif 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:
trueif field is part of the classes identity.
-
getProperty
Description copied from interface:PropertyHolderGet a property by its name.- Specified by:
getPropertyin interfacePropertyHolder- Parameters:
name- of the property- Returns:
- value of the property
-
setProperty
Description copied from interface:PropertyHolderSet a property specified by the name to the passed value.- Specified by:
setPropertyin interfacePropertyHolder- Parameters:
name- of the propertyvalue- of the property
-
addNature
Description copied from interface:NatureExtendableAdds a specified nature.- Specified by:
addNaturein interfaceNatureExtendable- Parameters:
nature- ID of the Nature
-
hasNature
Description copied from interface:NatureExtendableChecks if a specified nature has been added.- Specified by:
hasNaturein interfaceNatureExtendable- Parameters:
nature- ID of the Nature- Returns:
- true if the Nature ID was added.
-
getComparator
-
setComparator
-
getCollection
-
setCollection
-
isDirect
public boolean isDirect() -
setDirect
public void setDirect(boolean direct) -
getGetMethod
-
setGetMethod
-
getSetMethod
-
setSetMethod
-
getCreateMethod
-
setCreateMethod
-
isLazy
public boolean isLazy() -
setLazy
public void setLazy(boolean lazy) -
toString
-