Package org.castor.core.nature
Class BaseNature
java.lang.Object
org.castor.core.nature.BaseNature
- All Implemented Interfaces:
Nature
- Direct Known Subclasses:
ClassDescriptorJDONature
,ClassLoaderNature
,FieldDescriptorJDONature
,JDOClassInfoNature
,JDOFieldInfoNature
,JDOOneToManyNature
,JDOOneToOneNature
,JPAClassNature
,JPAFieldNature
,MappingLoaderNature
,PackageBasedCDRResolutionNature
,XMLInfoNature
Adds property handle methods and a constructor including a health check. See
constructor comments for more details.
- Since:
- 1.2.1
- Author:
- Lukas Lang
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BaseNature
(PropertyHolder holder) Constructor taking aPropertyHolder
. -
Method Summary
Modifier and TypeMethodDescriptionprotected final boolean
getBooleanPropertyDefaultFalse
(String propertyName) Returns boolean value of the property or false if property value is null.protected final PropertyHolder
Returns thePropertyHolder
.protected final Object
getProperty
(String key) Returns the property mapped to the key or null if not set before.protected List
getPropertyAsList
(String property) Returns value of the property as a List.protected Map
getPropertyAsMap
(String property) Returns value of the property as a List.protected final void
setProperty
(String key, Object property) Sets the property for a given.
-
Constructor Details
-
BaseNature
Constructor taking aPropertyHolder
. Must be called from subclasses. Does a health check on the given PropertyHolder, whether the extending Nature exists.- Parameters:
holder
- a PropertyHolder.
-
-
Method Details
-
getProperty
Returns the property mapped to the key or null if not set before.- Parameters:
key
- to look up.- Returns:
- value or null if not found.
-
setProperty
Sets the property for a given. Key must NOT be null, but can be an empty String.- Parameters:
key
- to insert.property
- to set.
-
getBooleanPropertyDefaultFalse
Returns boolean value of the property or false if property value is null. Make sure, not to request a property, which does not have a boolean value!- Parameters:
propertyName
- name of the property.- Returns:
- false if null or false.
-
getHolder
Returns thePropertyHolder
.- Returns:
- the holder
-
getPropertyAsList
Returns value of the property as a List. If the property was not set before, a new List will be returned. Make sure, not to request a property, which is not a List!- Parameters:
propertyName
- name of the property.- Returns:
- A List.
-
getPropertyAsMap
Returns value of the property as a List. If the property was not set before, a new List will be returned. Make sure, not to request a property, which is not a List!- Parameters:
propertyName
- name of the property.- Returns:
- A List.
-