AbstractConfigurableEntity Class
- public abstract class AbstractConfigurableEntity
extends Object
implements ConfigurableEntity
, Serializable
Abstract base class for ConfigurableEntity implementations. This class
provides the basic CE functionality, including explicit properties,
but does not persist properties in any way. It also does not use Property
Sets for property validation or default value retrieval.
Any classes that wish to use the ConfigurableEntity functionality in
a lightweight object should extend this.
-
Hierarchy
-
Object
AbstractConfigurableEntity
-
All Implemented Interfaces
-
ConfigurableEntity
, Serializable
-
Direct Known Subclasses
-
AbstractHierarchicalEntity
, ConfigurableEntityImpl
, Event
public static PropertyMapKey |
-
createMapKey (String propertySet, String propertyName)
- Helper function that will allocate a PropertyMapKey from a
property set name and property name.
|
public Object |
-
getCachedProperty (String propertySet, String propertyName)
- Retrieve the value associated with the key from the object cache
|
protected Object |
-
getExplicitProperty (String propertyName)
- Find and invoke the explicit accessor method for the given property
in the implementation class of the entity.
|
protected Method |
-
getExplicitSetter (String propertyName, Object value)
- Search for a setter method for the given property name and value object.
|
protected Object |
-
getImplicitProperty (String propertySet, String propertyName)
- Look for a value for the given property in the standard
database tables.
|
public String |
-
getJndiName ()
- Retrieve the jndi name for an entity.
|
public String |
-
getPkString ()
- Retrieve the pk string for an entity.
|
public Object |
-
getProperty (String propertySet, String propertyName)
- Retrieve the value that was persisted for this entity for the
given property, within the given property set.
|
public String |
-
getPropertyAsString (String propertySet, String propertyName)
- Convenience method to return a property as a String.
|
public EntityPropertyCache |
-
getPropertyCache ()
- Allocate the property map and load it using the EntityPropertyManager.
|
public Object |
-
getPropertyNoDefault (String propertySet, String propertyName)
- Retrieve the value associated with the named key in the
specified property set, but does not return a default value
from the property's PropertyDefinition
if a value was not persisted for this entity.
|
public long |
-
getUniqueId ()
- Retrieve the unique identifier generated for this ConfigurableEntity.
|
protected boolean |
-
hasExplicitGetter (String propertyName)
- Determine if an explicit getter method exists for the given property in
the implementation class of the entity.
|
protected boolean |
-
hasExplicitSetter (String propertyName, Object value)
- Determine if an explicit setter method exists for the given property in
the implementation class of the entity.
|
protected void |
-
removeExplicitProperty (String propertyName, Object prototypeValue)
|
public Object |
-
removeProperty (String propertySet, String propertyName)
- Remove the property associated with the named key in the specified
property set.
|
protected void |
-
setExplicitProperty (String propertyName, Object value)
- Set a property on the entity using the explicit set.
|
public void |
-
setProperty (String propertySet, String propertyName, Object value)
- Associate the specified value with the named key in the specified
property set.
|
protected final String |
-
upcaseFirst (String s)
- Make the first letter of the string upper cased.
|
Methods from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CE_METHOD_CACHE
protected static final String
CE_METHOD_CACHE
- cache name for CE explicit methods
instanceClass
protected Class
instanceClass
- The actual implementation class of this entity
PREFIX_GET
protected static final String
PREFIX_GET
- prefix to find accessor methods via reflection
PREFIX_SET
protected static final String
PREFIX_SET
- prefix to find mutator methods via reflection
propertyCache
protected transient EntityPropertyCache
propertyCache
- internal store of properties
textFormatter
protected static final PropertyExceptionTextFormatter
textFormatter
- Exception class
AbstractConfigurableEntity
public AbstractConfigurableEntity()
createMapKey(String, String) Method
public static PropertyMapKey
createMapKey(String
propertySet,
String
propertyName)
Helper function that will allocate a PropertyMapKey from a
property set name and property name.
Parameters
-
propertySet
- the property set name to use
-
propertyName
- the property name to use
Returns
- a PropertyMapKey representing that property
getCachedProperty(String, String) Method
public Object
getCachedProperty(String
propertySet,
String
propertyName)
throws RemoteException
Retrieve the value associated with the key from the object cache
Parameters
-
propertySet
- The property set to look in
-
propertyName
- The name of the property
Returns
- the property's value, or null if it was not found
Exceptions
-
RemoteException
getExplicitProperty(String) Method
protected Object
getExplicitProperty(String
propertyName)
Find and invoke the explicit accessor method for the given property
in the implementation class of the entity.
Parameters
-
propertyName
- the name of the property to look for
Returns
- the value returned from the accessor, or null if the accessor was not found
getExplicitSetter(String, Object) Method
protected Method
getExplicitSetter(String
propertyName,
Object
value)
Search for a setter method for the given property name and value object. This will
look in the current CE impl class for a setter of the form set which takes
as its argument an object of the same type as the value object, or a superclass, or an
interface that the value object implements.
Returns
- the setter method, or null if none exists.
getImplicitProperty(String, String) Method
protected Object
getImplicitProperty(String
propertySet,
String
propertyName)
throws RemoteException
Look for a value for the given property in the standard
database tables.
Parameters
-
propertySet
- the property set to look in
-
propertyName
- the name of the property
Returns
- the property value, or null if it was not found
Exceptions
-
RemoteException
getJndiName() Method
public String
getJndiName()
throws RemoteException
Retrieve the jndi name for an entity. A combination of pk string
and jndi name is always unique between entities.
Returns
- the jndi name for this entity
Exceptions
-
RemoteException
getPkString() Method
public String
getPkString()
throws RemoteException
Retrieve the pk string for an entity. A combination of pk string
and jndi name is always unique between entities.
Returns
- the primary key string identifier for this entity
Exceptions
-
RemoteException
getProperty(String, String) Method
public Object
getProperty(String
propertySet,
String
propertyName)
throws RemoteException
Retrieve the value that was persisted for this entity for the
given property, within the given property set. If the entity
does not have a value persisted for this property, the default
value from the property set will be returned.
Parameters
-
propertySet
- The name of the property set to look in
-
propertyName
- The name of the property to retrieve.
Returns
- the value for this property, or null if all searches failed
Exceptions
-
RemoteException
getPropertyAsString(String, String) Method
public String
getPropertyAsString(String
propertySet,
String
propertyName)
throws RemoteException
Convenience method to return a property as a String.
Parameters
-
propertySet
- The name of the property set to look in
-
propertyName
- The name of the property to retrieve.
Returns
- the value for this property as a String, or null if all searches failed
Exceptions
-
RemoteException
getPropertyCache() Method
public EntityPropertyCache
getPropertyCache()
throws RemoteException
Allocate the property map and load it using the EntityPropertyManager.
Returns
- a full container of properties for this entity
Exceptions
-
RemoteException
getPropertyNoDefault(String, String) Method
public Object
getPropertyNoDefault(String
propertySet,
String
propertyName)
throws RemoteException
Retrieve the value associated with the named key in the
specified property set, but does not return a default value
from the property's PropertyDefinition
if a value was not persisted for this entity.
This method is used by the implementation
of the getProperty methods so that the search in the
successor hierarchy does not return a default value from
the Schema.
Parameters
-
propertySet
- The name of the property set
-
propertyName
- The name of the property to retrieve.
Returns
- the value for this property, or null if all searches failed
Exceptions
-
RemoteException
getUniqueId() Method
public long getUniqueId()
throws RemoteException
Retrieve the unique identifier generated for this ConfigurableEntity.
The unique identifier is used by the EntityPropertyManager to
optimize the foreign keys in the persistent storage. This method may
not be implemented in a lightweight implementation of
ConfigurableEntity.
Returns
- this entity's unique id
Exceptions
-
RemoteException
hasExplicitGetter(String) Method
protected boolean hasExplicitGetter(String
propertyName)
Determine if an explicit getter method exists for the given property in
the implementation class of the entity.
Parameters
-
propertyName
- the name of the property to look for
Returns
- true if an explicit accessor exists, false otherwise
hasExplicitSetter(String, Object) Method
protected boolean hasExplicitSetter(String
propertyName,
Object
value)
Determine if an explicit setter method exists for the given property in
the implementation class of the entity.
Parameters
-
propertyName
- the name of the property to look for
-
value
- a value that represents the property type to look for
Returns
- true if an explicit mutator exists, false otherwise
removeExplicitProperty(String, Object) Method
protected void removeExplicitProperty(String
propertyName,
Object
prototypeValue)
removeProperty(String, String) Method
public Object
removeProperty(String
propertySet,
String
propertyName)
throws RemoteException
Remove the property associated with the named key in the specified
property set.
NOTE: if an explicit setter method is found for this property, this
method will set the value to null.
Parameters
-
propertySet
- The name of the property set.
-
propertyName
- The name of the property to remove.
Returns
- the old value of the property, or null if there was none.
Exceptions
-
RemoteException
setExplicitProperty(String, Object) Method
protected void setExplicitProperty(String
propertyName,
Object
value)
Set a property on the entity using the explicit set.
Parameters
-
propertyName
- the name of the property to set
-
value
- the value to pass to the mutator method
setProperty(String, String, Object) Method
public void setProperty(String
propertySet,
String
propertyName,
Object
value)
throws PropertyValidationException
, RemoteException
Associate the specified value with the named key in the specified
property set.
Parameters
-
propertySet
- The name of the property set.
-
propertyName
- The name of the property to assign
-
value
- The value to associate with the property name
Exceptions
-
PropertyValidationException
- If the property value does not match the PropertyDefinition for this property set
-
RemoteException
upcaseFirst(String) Method
protected final String
upcaseFirst(String
s)
Make the first letter of the string upper cased.
Parameters
-
s
- the string to process
Returns
- the processed string