Package org.exolab.castor.builder.info
Class FieldInfo
java.lang.Object
org.exolab.castor.builder.info.FieldInfo
- All Implemented Interfaces:
NatureExtendable
,PropertyHolder
,XMLInfo
- Direct Known Subclasses:
CollectionInfo
,IdentityInfo
A class for representing field members of a class. FieldInfo objects hold all
the information required about a member in order to be able to produce
XML data binding (marshal/unmarshal) and validation code.
- Version:
- $Revision: 7996 $ $Date: 2006-04-25 15:08:23 -0600 (Tue, 25 Apr 2006) $
- Author:
- Keith Visco
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
Method prefixes for "Add" methods.protected static final String
Method prefixes for "Delete" methods.protected static final String
Method prefixes for "Get" methods.protected static final String
Method prefixes for "Has" methods.protected static final String
Method prefixes for "Is" methods.protected static final String
Method prefixes for "Set" methods.static final int
The Read / Getter method flag.static final int
The Read and Write methods flags.static final int
The Write / Setter method flag.Fields inherited from interface org.exolab.castor.builder.info.XMLInfo
CHOICE_NODE_NAME_ERROR_INDICATION
-
Constructor Summary
ConstructorsConstructorDescriptionFieldInfo
(XSType type, String name, FieldMemberAndAccessorFactory memberAndAccessorFactory) Creates a new FieldInfo with the given XML Schema type and the given member name. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Adds a specified nature.final String
Returns the comment associated with this Member.final ClassInfo
Returns the ClassInfo to which this Member was declared, for inheritance reasons.final String
Returns the default value for this FieldInfo.final String
Returns the name of the delete method for this FieldInfo.Returns the reference to theFieldInfo
instance within the same class.final String
Returns the fixed production for this FieldInfo, or null if no fixed value has been specified.final String
Returns the name of the has method for this FieldInfo.final String
Get the 'is' method for this FieldInfo.Returns the FieldMemberAndAccessorFactory instance to use to create a JField out of this FieldInfo.final int
Returns the methods flag that indicates which.Returns the method suffix for creating method names.final String
getName()
Returns the name of this FieldInfo.final Object
getProperty
(String name) Get a property by its name.final String
Returns the name of the read method for this FieldInfo.Returns the possible substitution groups for this class.final String
Returns the fully qualified name of the Validator to use.Returns this field's 'visibility'.final String
Returns the name of the write method for this FieldInfo.final String
Returns the fully qualified name of the XMLFieldHandler to use.final boolean
Checks if a specified nature has been added.final boolean
isBound()
Returns true if this FieldInfo represents a bound property.final boolean
Returns true if this FieldInfo describes a container class.boolean
isFinal()
Indicates whether this field is final.final boolean
Returns true if this field represents a nillable field.boolean
isStatic()
Indicates whether this field is static.final boolean
Returns true if this FieldInfo is a transient member.final boolean
Returns true if the "has" and "delete" methods are needed for the field associated with this FieldInfo.final void
setBound
(boolean bound) Sets whether or not this FieldInfo represents a bound property.final void
setComment
(String comment) Sets the comment for this Member.final void
setContainer
(boolean isContainer) Sets whether or not this FieldInfo describes a container field.final void
setDeclaringClassInfo
(ClassInfo declaringClassInfo) Sets theClassInfo
of the class that declares this field.final void
setDefaultValue
(String defaultValue) Sets the default value for this FieldInfo.final void
setFieldInfoReference
(FieldInfo fieldInfo) Sets the name of the field within the same class that is a reference to this field.final void
setFinal
(boolean isFinal) Sets the "final" status of this FieldInfo.final void
setFixedValue
(String fixedValue) Sets the fixed value in which instances of this field type must lexically match.final void
setMethods
(int methods) Sets which methods to create: READ_METHOD, WRITE_METHOD, READ_WRITE_METHODS.final void
setNillable
(boolean nillable) Sets whether or not this field can be nillable.final void
setProperty
(String name, Object value) Set a property specified by the name to the passed value.final void
setStatic
(boolean isStatic) Sets the "static" status of this FieldInfo.void
setSubstitutionGroupMembers
(List<String> substitutionGroupMembers) Sets the possible substitution groups for this class.final void
setTransient
(boolean isTransient) Sets the transient status of this FieldInfo.final void
setValidator
(String validator) Sets the name of the Validator to use.final void
setVisibility
(String visibility) Sets the visibility of this FieldInfo.final void
setXMLFieldHandler
(String handler) Sets the name of the XMLfieldHandler to use.
-
Field Details
-
READ_METHOD
public static final int READ_METHODThe Read / Getter method flag.- See Also:
-
WRITE_METHOD
public static final int WRITE_METHODThe Write / Setter method flag.- See Also:
-
READ_WRITE_METHODS
public static final int READ_WRITE_METHODSThe Read and Write methods flags.- See Also:
-
METHOD_PREFIX_ADD
Method prefixes for "Add" methods.- See Also:
-
METHOD_PREFIX_DELETE
Method prefixes for "Delete" methods.- See Also:
-
METHOD_PREFIX_GET
Method prefixes for "Get" methods.- See Also:
-
METHOD_PREFIX_HAS
Method prefixes for "Has" methods.- See Also:
-
METHOD_PREFIX_SET
Method prefixes for "Set" methods.- See Also:
-
METHOD_PREFIX_IS
Method prefixes for "Is" methods.- See Also:
-
-
Constructor Details
-
FieldInfo
Creates a new FieldInfo with the given XML Schema type and the given member name. Adds theXMLInfoNature
for legacy compliance.- Parameters:
type
- the XML Schema type of this membername
- the name of the membermemberAndAccessorFactory
- the FieldMemberAndAccessorFactory to be used
-
-
Method Details
-
getMemberAndAccessorFactory
Returns the FieldMemberAndAccessorFactory instance to use to create a JField out of this FieldInfo.- Returns:
- the suitable FieldMemberAndAccessorFactory
-
getDefaultValue
Returns the default value for this FieldInfo.- Returns:
- the default value for this FieldInfo, or null if no default value was set;
-
getFixedValue
Returns the fixed production for this FieldInfo, or null if no fixed value has been specified.NOTE: Fixed values are NOT the same as default values
- Returns:
- the fixed value for this FieldInfo
-
getDeleteMethodName
Returns the name of the delete method for this FieldInfo.- Returns:
- the name of the delete method for this FieldInfo.
-
getHasMethodName
Returns the name of the has method for this FieldInfo.- Returns:
- the name of the has method for this FieldInfo.
-
getReadMethodName
Returns the name of the read method for this FieldInfo.- Returns:
- the name of the read method for this FieldInfo.
-
getValidator
Returns the fully qualified name of the Validator to use.- Returns:
- the fully qualified name of the Validator to use.
-
getWriteMethodName
Returns the name of the write method for this FieldInfo.- Returns:
- the name of the write method for this FieldInfo.
-
getIsMethodName
Get the 'is' method for this FieldInfo.- Returns:
- the name of the 'is' method for this FieldInfo
-
getXMLFieldHandler
Returns the fully qualified name of the XMLFieldHandler to use.- Returns:
- the fully qualified name of the XMLFieldHandler to use.
-
getComment
Returns the comment associated with this Member.- Returns:
- the comment associated with this Member, or null. if one has not been set.
-
getMethods
public final int getMethods()Returns the methods flag that indicates which. methods will be created.- Returns:
- the methods flag
-
getName
Returns the name of this FieldInfo.- Returns:
- the name of this FieldInfo.
-
isBound
public final boolean isBound()Returns true if this FieldInfo represents a bound property.- Returns:
- true if this FieldInfo represents a bound property.
-
isContainer
public final boolean isContainer()Returns true if this FieldInfo describes a container class. A container class is a class which should not be marshalled as XML, but whose members should be.- Returns:
- true if this ClassInfo describes a container class.
-
requiresHasAndDeleteMethods
public final boolean requiresHasAndDeleteMethods()Returns true if the "has" and "delete" methods are needed for the field associated with this FieldInfo.- Returns:
- true if the has and delete methods are needed.
-
isNillable
public final boolean isNillable()Returns true if this field represents a nillable field. A nillable field is a field that can have null content (see XML Schema 1.0 definition of nillable).- Returns:
- true if nillable, otherwise false.
- See Also:
-
isTransient
public final boolean isTransient()Returns true if this FieldInfo is a transient member. Transient members are members which should be ignored by the Marshalling framework.- Returns:
- true if this FieldInfo is transient.
-
setComment
Sets the comment for this Member.- Parameters:
comment
- the comment or description for this Member
-
getDeclaringClassInfo
Returns the ClassInfo to which this Member was declared, for inheritance reasons.- Returns:
- the ClassInfo to which this Member was declared.
-
setBound
public final void setBound(boolean bound) Sets whether or not this FieldInfo represents a bound property.- Parameters:
bound
- the flag when true indicates that this FieldInfo represents a bound property.
-
setContainer
public final void setContainer(boolean isContainer) Sets whether or not this FieldInfo describes a container field. A container field is a field which should not be marshalled directly as XML, but whose members should be. By default this is false.- Parameters:
isContainer
- the boolean value when true indicates this class should be a container class.
-
setDeclaringClassInfo
Sets theClassInfo
of the class that declares this field.- Parameters:
declaringClassInfo
- TheClassInfo
of the declaring class.
-
setDefaultValue
Sets the default value for this FieldInfo.- Parameters:
defaultValue
- the default value
-
setFinal
public final void setFinal(boolean isFinal) Sets the "final" status of this FieldInfo. Final members are also transient.- Parameters:
isFinal
- the boolean indicating the final status, if true this FieldInfo will be treated as final.
-
setFixedValue
Sets the fixed value in which instances of this field type must lexically match. NOTE: This is not the same as default value!- Parameters:
fixedValue
- the fixed production for this FieldInfo
-
setMethods
public final void setMethods(int methods) Sets which methods to create: READ_METHOD, WRITE_METHOD, READ_WRITE_METHODS.- Parameters:
methods
- a flag describing which methods to create.
-
setNillable
public final void setNillable(boolean nillable) Sets whether or not this field can be nillable.- Parameters:
nillable
- a boolean that when true means the field may be nil.- See Also:
-
setFieldInfoReference
Sets the name of the field within the same class that is a reference to this field.- Parameters:
fieldInfo
-FieldInfo
for the referencing field (within the same class).
-
setStatic
public final void setStatic(boolean isStatic) Sets the "static" status of this FieldInfo. Static members are also transient.- Parameters:
isStatic
- the boolean indicating the static status, if true this FieldInfo will be treated as static
-
setTransient
public final void setTransient(boolean isTransient) Sets the transient status of this FieldInfo.- Parameters:
isTransient
- the boolean indicating the transient status, if true this FieldInfo will be treated as transient
-
setValidator
Sets the name of the Validator to use.- Parameters:
validator
- the fully qualified name of the validator to use.
-
setXMLFieldHandler
Sets the name of the XMLfieldHandler to use.- Parameters:
handler
- the fully qualified name of the handler to use.
-
getMethodSuffix
Returns the method suffix for creating method names.- Returns:
- the method suffix used when creating method names.
-
setVisibility
Sets the visibility of this FieldInfo.- Parameters:
visibility
- the visibility of this FieldInfo.
-
setSubstitutionGroupMembers
Sets the possible substitution groups for this class.- Parameters:
substitutionGroupMembers
- Possible substitution groups for this class.
-
getSubstitutionGroupMembers
Returns the possible substitution groups for this class.- Returns:
- the possible substitution groups for this class.
-
isStatic
public boolean isStatic()Indicates whether this field is static.- Returns:
- True if this field is static.
-
isFinal
public boolean isFinal()Indicates whether this field is final.- Returns:
- True if this field is final.
-
getVisibility
Returns this field's 'visibility'.- Returns:
- This field's visibility.
-
getFieldInfoReference
Returns the reference to theFieldInfo
instance within the same class.- Returns:
- the reference to the
FieldInfo
instance
-
getProperty
Description copied from interface:PropertyHolder
Get a property by its name.- Specified by:
getProperty
in interfacePropertyHolder
- Parameters:
name
- of the property- Returns:
- value of the property
-
setProperty
Description copied from interface:PropertyHolder
Set a property specified by the name to the passed value.- Specified by:
setProperty
in interfacePropertyHolder
- Parameters:
name
- of the propertyvalue
- of the property
-
addNature
Description copied from interface:NatureExtendable
Adds a specified nature.- Specified by:
addNature
in interfaceNatureExtendable
- Parameters:
nature
- ID of the Nature
-
hasNature
Description copied from interface:NatureExtendable
Checks if a specified nature has been added.- Specified by:
hasNature
in interfaceNatureExtendable
- Parameters:
nature
- ID of the Nature- Returns:
- true if the Nature ID was added.
-