Package org.castor.cpa.jpa.info
Class FieldInfo
- java.lang.Object
-
- org.castor.cpa.jpa.info.FieldInfo
-
- All Implemented Interfaces:
NatureExtendable
,PropertyHolder
public class FieldInfo extends java.lang.Object implements 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 Constructor Description FieldInfo(ClassInfo declaringClassInfo, java.lang.Class<?> fieldType, java.lang.String fieldName, java.lang.reflect.Method getterMethod, java.lang.reflect.Method setterMethod)
Creates a FieldInfo associated to the givenClassInfo
, describing the given a field with the given name using method (property) access.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNature(java.lang.String nature)
Adds a specified nature.ClassInfo
getDeclaringClassInfo()
java.lang.String
getFieldName()
Indicates the name of the field described by thisFieldInfo
.java.lang.Class<?>
getFieldType()
Indicates the type of the field described by thisFieldInfo
.java.lang.reflect.Method
getGetterMethod()
Indicates the getter access method of the field.java.lang.Object
getProperty(java.lang.String name)
Get a property by its name.java.lang.reflect.Method
getSetterMethod()
Indicates the setter access method of the field.boolean
hasNature(java.lang.String nature)
Checks if a specified nature has been added.void
setDeclaringClassInfo(ClassInfo classInfo)
void
setFieldName(java.lang.String fieldName)
Sets the name of the field described by thisFieldInfo
.void
setFieldType(java.lang.Class<?> fieldType)
Sets the type of the field described by thisFieldInfo
.void
setGetterMethod(java.lang.reflect.Method getterMethod)
Sets the getter access method of the field.void
setProperty(java.lang.String name, java.lang.Object value)
Set a property specified by the name to the passed value.void
setSetterMethod(java.lang.reflect.Method setterMethod)
Sets the setter access method of the field.
-
-
-
Constructor Detail
-
FieldInfo
public FieldInfo(ClassInfo declaringClassInfo, java.lang.Class<?> fieldType, java.lang.String fieldName, java.lang.reflect.Method getterMethod, java.lang.reflect.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 Detail
-
addNature
public void addNature(java.lang.String nature)
Adds a specified nature.- Specified by:
addNature
in interfaceNatureExtendable
- Parameters:
nature
- the name of the nature- See Also:
NatureExtendable.addNature(java.lang.String)
-
hasNature
public boolean hasNature(java.lang.String nature)
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:
NatureExtendable.hasNature(java.lang.String)
-
getProperty
public java.lang.Object getProperty(java.lang.String name)
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:
PropertyHolder.getProperty(java.lang.String)
-
setProperty
public void setProperty(java.lang.String name, java.lang.Object value)
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:
PropertyHolder.setProperty(java.lang.String, java.lang.Object)
-
getDeclaringClassInfo
public ClassInfo getDeclaringClassInfo()
-
setDeclaringClassInfo
public void setDeclaringClassInfo(ClassInfo classInfo)
- Parameters:
classInfo
- The ClassInfo this FieldInfo is associated with.
-
getFieldName
public java.lang.String getFieldName()
Indicates the name of the field described by thisFieldInfo
.- Returns:
- the name of the field described by this
FieldInfo
.
-
setFieldName
public void setFieldName(java.lang.String fieldName)
Sets the name of the field described by thisFieldInfo
.- Parameters:
fieldName
- set the name of the field described by thisFieldInfo
.
-
getFieldType
public java.lang.Class<?> getFieldType()
Indicates the type of the field described by thisFieldInfo
.- Returns:
- the type of the field.
-
setFieldType
public void setFieldType(java.lang.Class<?> fieldType)
Sets the type of the field described by thisFieldInfo
.- Parameters:
fieldType
- The Type of the field.
-
getGetterMethod
public java.lang.reflect.Method getGetterMethod()
Indicates the getter access method of the field.- Returns:
- the getter method reference of the field.
-
setGetterMethod
public void setGetterMethod(java.lang.reflect.Method getterMethod)
Sets the getter access method of the field.- Parameters:
getterMethod
- the getter method reference.
-
getSetterMethod
public java.lang.reflect.Method getSetterMethod()
Indicates the setter access method of the field.- Returns:
- the setter method reference of the field.
-
setSetterMethod
public void setSetterMethod(java.lang.reflect.Method setterMethod)
Sets the setter access method of the field.- Parameters:
setterMethod
- the setter method reference.
-
-