ariba.util.core
Class ClassExtension

java.lang.Object
  extended by ariba.util.core.ClassExtension
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
ArithmeticOperations, AWBookmarkFormatter, AWDebugTrace.MetaProvider, AWFormatting, AWMap, AWSelfAccess, AWSemanticKeyProvider, AWVFormatterAccess, BigDecimalMoneyFormatter.BigDecimalMoneyAdaptor, BigDecimalMoneyFormatter.CurrencyAdapter, ChoiceSource, FieldValue, MetaContext.ComponentClassExtension, OrderedList, OSSWriter.OSSSerialize, RelationshipField

public abstract class ClassExtension
extends Object
implements Cloneable

The ClassExtension class is the abstract superclass for all ClassExtension subclasses. This class provides a slot for the intended class for the ClassExtension as well as an implementation of the clone() method. Both these methods are used by the ClassExtensionRegistry class which provide a convenient mechanism for caching Categories by their corresponding class. A ClassExtension is a collection of behavior/methods that can be associated with an existing class. Often, this is serves as a way to provide a concrete implementation for an 'interface' and attach that interface to existing classes. For example, the FieldValue interface uses the FieldValue_Object as the base implementation which is associated with the Object class. Categories can be subclassed when some of the behavior in a superclass' classExtension needs to be overridden. Often, a Cateogry will be implemented as a static innerclass so it may have access to the private instance variables of the class with which the ClassExtension is being associated. It should be noted that the ClassExtensionRegistry class will clone its registered Categories as needed to flesh out the cache so that each class which needs a Cateogry from the cache will be able to get it directly without traversing up the superclass chain. This is why we expose the setForClass() method -- to allow the ClassExtensionRegistry object the ability to clone and reset the forClass for each subclass for which the ClassExtension applies. The ClassExtensionRegistry uses the forClass variable to determine if the previousClassExtension can be used for the current target object.


Field Summary
 Class forClass
           
 
Constructor Summary
ClassExtension()
           
 
Method Summary
 Object clone()
          Allows for cloning existing Categories so that the same ClassExtension may be cached multiple times, once for each subclass that inherits the ClassExtension.
 Class forClass()
          Returns the forClass variable which indicates for which class this copy of the classExtension applies.
static Class getRealClass(Object target)
          Returns the real Class for the target object; if target is a kind of ClassProxy, call getRealClass on it, otherwise just call getClass.
 void setForClass(Class classValue)
          Sets the forClass variable which indicates for which class this copy of the classExtension applies.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

forClass

public Class forClass
Constructor Detail

ClassExtension

public ClassExtension()
Method Detail

setForClass

public void setForClass(Class classValue)
Sets the forClass variable which indicates for which class this copy of the classExtension applies.

Parameters:
classValue - the class for which this copy of the ClassExtension applies.

forClass

public Class forClass()
Returns the forClass variable which indicates for which class this copy of the classExtension applies.

Returns:
the class for which this copy of the ClassExtension applies.

clone

public Object clone()
Allows for cloning existing Categories so that the same ClassExtension may be cached multiple times, once for each subclass that inherits the ClassExtension.

Overrides:
clone in class Object
Returns:
a new ClassExtension instance with the same instance variables

getRealClass

public static Class getRealClass(Object target)
Returns the real Class for the target object; if target is a kind of ClassProxy, call getRealClass on it, otherwise just call getClass. Throws NullPointerException if target is null.



AribaWeb User Interface Development Framework
Copyright © 2000-2009 Ariba, Inc. All Rights Reserved.