Package org.castor.cpa.jpa.info
Class ClassInfo
java.lang.Object
org.castor.cpa.jpa.info.ClassInfo
- All Implemented Interfaces:
NatureExtendable
,PropertyHolder
This class holds the necessary information so that Castor can properly map a
JPA annotated
Class
to the database.- Since:
- 1.3
- Author:
- Peter Schmidt
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFieldInfo
(FieldInfo fieldInfo) void
Add aFieldInfo
to the key set of this ClassInfo (keys and attributes are disjunct!).void
Adds a specified nature.Class<?>
Class<?>
Get the reference to the Class object that is extended by this class.int
getFieldInfoByName
(String memberName) Returns aFieldInfo
that corresponds to an element with the given node name.Returns Set of associated fields.int
getKeyFieldInfoByName
(String keyName) Returns aFieldInfo
that corresponds to a key element with the given node name.Returns Set of key fields.getProperty
(String name) Get a property by its name.boolean
Checks if a specified nature has been added.void
setDescribedClass
(Class<?> describedClass) void
setProperty
(String name, Object value) Set a property specified by the name to the passed value.
-
Constructor Details
-
ClassInfo
public ClassInfo()Creates a new empty ClassInfo. -
ClassInfo
Creates a new ClassInfo, describing a given Class.- Parameters:
describedClass
- the Class that is described by this ClassInfo.
-
-
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:
-
getDescribedClass
- Returns:
- The reference to the Class object that is described by this ClassInfo.
-
setDescribedClass
-
addFieldInfo
-
getFieldCount
public int getFieldCount() -
getFieldInfoByName
Returns aFieldInfo
that corresponds to an element with the given node name.- Parameters:
memberName
- the name of the field to get.- Returns:
- a
FieldInfo
that corresponds to an element with the given node name or null if that field does not exist.
-
getFieldInfos
Returns Set of associated fields. If no fields are associated, null is returned. This returned set is just a copy of the internal one, so changes to the Set will not affect the internal Set.- Returns:
- a Set of associated fields.
-
addKey
Add aFieldInfo
to the key set of this ClassInfo (keys and attributes are disjunct!). It is only inserted once in each of these lists, so normal elements can be "raised" to be keys after first adding them to the class.- Parameters:
key
- - the FieldInfo to add to the set of key fields.
-
getKeyFieldCount
public int getKeyFieldCount()- Returns:
- the number of
FieldInfo
definitions for this ClassInfo's key.
-
getKeyFieldInfoByName
Returns aFieldInfo
that corresponds to a key element with the given node name.- Parameters:
keyName
- the name of the key field to get.- Returns:
- a
FieldInfo
that corresponds to a key element with the given node name or null if that field is not in the key set.
-
getKeyFieldInfos
Returns Set of key fields. If no fields are associated, null is returned. This returned Set is just a copy of the internal one, so changes to the Set will not affect the internal key set.- Returns:
- an array of associated fields.
-
getExtendedClass
Get the reference to the Class object that is extended by this class.- Returns:
- the superclass of the described class.
-