Package org.castor.cpa.jpa.info
Class FieldInfo
java.lang.Object
org.castor.cpa.jpa.info.FieldInfo
- All Implemented Interfaces:
NatureExtendable
,PropertyHolder
This class holds the necessary information so that Castor can properly map a
JPA annotated classes member to the database.
- Since:
- 1.3
- Author:
- Peter Schmidt
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a specified nature.Indicates the name of the field described by thisFieldInfo
.Class<?>
Indicates the type of the field described by thisFieldInfo
.Indicates the getter access method of the field.getProperty
(String name) Get a property by its name.Indicates the setter access method of the field.boolean
Checks if a specified nature has been added.void
setDeclaringClassInfo
(ClassInfo classInfo) void
setFieldName
(String fieldName) Sets the name of the field described by thisFieldInfo
.void
setFieldType
(Class<?> fieldType) Sets the type of the field described by thisFieldInfo
.void
setGetterMethod
(Method getterMethod) Sets the getter access method of the field.void
setProperty
(String name, Object value) Set a property specified by the name to the passed value.void
setSetterMethod
(Method setterMethod) Sets the setter access method of the field.
-
Constructor Details
-
FieldInfo
public FieldInfo(ClassInfo declaringClassInfo, Class<?> fieldType, String fieldName, Method getterMethod, Method setterMethod) Creates a FieldInfo associated to the givenClassInfo
, describing the given a field with the given name using method (property) access.- Parameters:
declaringClassInfo
- The ClassInfo this FieldInfo is associated with.fieldType
- The type of the described field.fieldName
- The name of the described field.getterMethod
- The reference to the getter method of the Field.setterMethod
- The reference to the setter method of the Field.
-
-
Method Details
-
addNature
Adds a specified nature.- Specified by:
addNature
in interfaceNatureExtendable
- Parameters:
nature
- the name of the nature- See Also:
-
hasNature
Checks if a specified nature has been added.- Specified by:
hasNature
in interfaceNatureExtendable
- Parameters:
nature
- the name of the nature.- Returns:
- true if the specified nature was added.
- See Also:
-
getProperty
Get a property by its name.- Specified by:
getProperty
in interfacePropertyHolder
- Parameters:
name
- the name of the property to get.- Returns:
- the property as specified by the name.
- See Also:
-
setProperty
Set a property specified by the name to the passed value.- Specified by:
setProperty
in interfacePropertyHolder
- Parameters:
name
- the name of the property to set.value
- the value to set the specified property to.- See Also:
-
getDeclaringClassInfo
-
setDeclaringClassInfo
- Parameters:
classInfo
- The ClassInfo this FieldInfo is associated with.
-
getFieldName
Indicates the name of the field described by thisFieldInfo
.- Returns:
- the name of the field described by this
FieldInfo
.
-
setFieldName
Sets the name of the field described by thisFieldInfo
.- Parameters:
fieldName
- set the name of the field described by thisFieldInfo
.
-
getFieldType
Indicates the type of the field described by thisFieldInfo
.- Returns:
- the type of the field.
-
setFieldType
Sets the type of the field described by thisFieldInfo
.- Parameters:
fieldType
- The Type of the field.
-
getGetterMethod
Indicates the getter access method of the field.- Returns:
- the getter method reference of the field.
-
setGetterMethod
Sets the getter access method of the field.- Parameters:
getterMethod
- the getter method reference.
-
getSetterMethod
Indicates the setter access method of the field.- Returns:
- the setter method reference of the field.
-
setSetterMethod
Sets the setter access method of the field.- Parameters:
setterMethod
- the setter method reference.
-