org.castor.core.nature
Class BaseNature

java.lang.Object
  extended by org.castor.core.nature.BaseNature
All Implemented Interfaces:
Nature
Direct Known Subclasses:
ClassDescriptorJDONature, ClassLoaderNature, FieldDescriptorJDONature, JDOClassInfoNature, JDOFieldInfoNature, JDOOneToManyNature, JDOOneToOneNature, JPAClassNature, JPAFieldNature, MappingLoaderNature, PackageBasedCDRResolutionNature, XMLInfoNature

public abstract class BaseNature
extends java.lang.Object
implements Nature

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
protected BaseNature(PropertyHolder holder)
          Constructor taking a PropertyHolder.
 
Method Summary
protected  boolean getBooleanPropertyDefaultFalse(java.lang.String propertyName)
          Returns boolean value of the property or false if property value is null.
protected  PropertyHolder getHolder()
          Returns the PropertyHolder.
protected  java.lang.Object getProperty(java.lang.String key)
          Returns the property mapped to the key or null if not set before.
protected  java.util.List getPropertyAsList(java.lang.String property)
          Returns value of the property as a List.
protected  java.util.Map getPropertyAsMap(java.lang.String property)
          Returns value of the property as a List.
protected  void setProperty(java.lang.String key, java.lang.Object property)
          Sets the property for a given.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.castor.core.nature.Nature
getId
 

Constructor Detail

BaseNature

protected BaseNature(PropertyHolder holder)
Constructor taking a PropertyHolder. Must be called from subclasses. Does a health check on the given PropertyHolder, whether the extending Nature exists.

Parameters:
holder - a PropertyHolder.
Method Detail

getProperty

protected final java.lang.Object getProperty(java.lang.String key)
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

protected final void setProperty(java.lang.String key,
                                 java.lang.Object property)
Sets the property for a given. Key must NOT be null, but can be an empty String.

Parameters:
property - to set.
key - to insert.

getBooleanPropertyDefaultFalse

protected final boolean getBooleanPropertyDefaultFalse(java.lang.String propertyName)
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

protected final PropertyHolder getHolder()
Returns the PropertyHolder.

Returns:
the holder

getPropertyAsList

protected java.util.List getPropertyAsList(java.lang.String property)
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

protected java.util.Map getPropertyAsMap(java.lang.String property)
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.


Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com