com.bea.p13n.property
Class AbstractConfigurableEntity

java.lang.Object
  extended by com.bea.p13n.property.AbstractConfigurableEntity
All Implemented Interfaces
ConfigurableEntity, Serializable
Direct Known Subclasses:
AbstractHierarchicalEntity, ConfigurableEntityImpl, Event

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.

See Also
Serialized Form

Field Summary
protected static String CE_METHOD_CACHE
          cache name for CE explicit methods
protected  Class instanceClass
          The actual implementation class of this entity
protected static String PREFIX_GET
          prefix to find accessor methods via reflection
protected static String PREFIX_SET
          prefix to find mutator methods via reflection
protected  EntityPropertyCache propertyCache
          internal store of properties
protected static com.bea.p13n.i18n.PropertyExceptionTextFormatter textFormatter
          Exception class
 
Fields inherited from interface com.bea.p13n.property.ConfigurableEntity
RESERVED_PROPERTY_SET
 
Constructor Summary
AbstractConfigurableEntity()
           
 
Method Summary
static PropertyMapKey createMapKey(String propertySet, String propertyName)
          Helper function that will allocate a PropertyMapKey from a property set name and property name.
 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.
 String getJndiName()
          Retrieve the jndi name for an entity.
 String getPkString()
          Retrieve the pk string for an entity.
 Object getProperty(String propertySet, String propertyName)
          Retrieve the value that was persisted for this entity for the given property, within the given property set.
 String getPropertyAsString(String propertySet, String propertyName)
          Convenience method to return a property as a String.
 EntityPropertyCache getPropertyCache()
          Allocate the property map and load it using the EntityPropertyManager.
 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.
 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)
           
 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.
 void setProperty(String propertySet, String propertyName, Object value)
          Associate the specified value with the named key in the specified property set.
protected  String upcaseFirst(String s)
          Make the first letter of the string upper cased.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFIX_SET

protected static final String PREFIX_SET
prefix to find mutator methods via reflection

See Also
Constants Summary

PREFIX_GET

protected static final String PREFIX_GET
prefix to find accessor methods via reflection

See Also
Constants Summary

instanceClass

protected Class instanceClass
The actual implementation class of this entity


propertyCache

protected transient EntityPropertyCache propertyCache
internal store of properties


textFormatter

protected static final com.bea.p13n.i18n.PropertyExceptionTextFormatter textFormatter
Exception class


CE_METHOD_CACHE

protected static final String CE_METHOD_CACHE
cache name for CE explicit methods

See Also
Constants Summary
Constructor Detail

AbstractConfigurableEntity

public AbstractConfigurableEntity()
Method Detail

getProperty

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.

Specified by:
getProperty in interface ConfigurableEntity
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
Throws
RemoteException

getPropertyAsString

public String getPropertyAsString(String propertySet,
                                  String propertyName)
                           throws RemoteException
Convenience method to return a property as a String.

Specified by:
getPropertyAsString in interface ConfigurableEntity
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
Throws
RemoteException

getPropertyNoDefault

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.

Specified by:
getPropertyNoDefault in interface ConfigurableEntity
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
Throws
RemoteException

setProperty

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.

Specified by:
setProperty in interface ConfigurableEntity
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
Throws
PropertyValidationException - If the property value does not match the PropertyDefinition for this property set
RemoteException

removeProperty

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.

Specified by:
removeProperty in interface ConfigurableEntity
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.
Throws
RemoteException

getUniqueId

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.

Specified by:
getUniqueId in interface ConfigurableEntity
Returns
this entity's unique id
Throws
RemoteException

getPkString

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.

Specified by:
getPkString in interface ConfigurableEntity
Returns
the primary key string identifier for this entity
Throws
RemoteException

getJndiName

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.

Specified by:
getJndiName in interface ConfigurableEntity
Returns
the jndi name for this entity
Throws
RemoteException

getImplicitProperty

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
Throws
RemoteException

getCachedProperty

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
Throws
RemoteException

hasExplicitGetter

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

getExplicitProperty

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

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.

hasExplicitSetter

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

setExplicitProperty

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

removeExplicitProperty

protected void removeExplicitProperty(String propertyName,
                                      Object prototypeValue)

getPropertyCache

public EntityPropertyCache getPropertyCache()
                                     throws RemoteException
Allocate the property map and load it using the EntityPropertyManager.

Returns
a full container of properties for this entity
Throws
RemoteException

createMapKey

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

upcaseFirst

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


Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.