ariba.util.fieldvalue
Class BaseAccessor

java.lang.Object
  extended by ariba.util.fieldvalue.BaseAccessor
All Implemented Interfaces:
FieldValueAccessor
Direct Known Subclasses:
ExtensibleFieldValueAccessor, ReflectionMethodAccessor

public abstract class BaseAccessor
extends java.lang.Object
implements FieldValueAccessor

The BaseAccessor class is a base class that serves as the base for all FieldValueAccessors. FieldValueAccessors are used to set/get values on/from a target. The details of how to execute these operations is left to the subclasses and depends upon the type of the target object. For the most part, the subclass ReflectionFieldValueAccessor will do the job, but there may be cases where a more specific approach will yield more efficient, or more desired, results. Instances of FieldValueAccessor hold the (public) forClass variable so the FieldValue dispatching mechanism may quickly determine if the target's class and the FieldValueAccessor in question are compatible.


Method Summary
 java.lang.Class forClass()
          Returns the Class for which the accessor applies.
 java.lang.String getFieldName()
          Returns the fieldName which the accessor represents.
 boolean isApplicable(java.lang.Object target)
          This method is called when determining if a cached FieldValueAccessor is applicable for the target object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

forClass

public java.lang.Class forClass()
Returns the Class for which the accessor applies.

Specified by:
forClass in interface FieldValueAccessor

getFieldName

public java.lang.String getFieldName()
Returns the fieldName which the accessor represents. This is primarily for debugging.

Specified by:
getFieldName in interface FieldValueAccessor
Returns:
the fieldName string

isApplicable

public boolean isApplicable(java.lang.Object target)
This method is called when determining if a cached FieldValueAccessor is applicable for the target object. Special subclasses should override this if they need additional tests for applicability. The default test is to check if the target.getClass() == accessor.forClass and, if so, then this method is called for further checking. If this method returns false, the cached accessor is ignored and a new one will be obtained by performaing a more expensive lookup.

Specified by:
isApplicable in interface FieldValueAccessor
Parameters:
target - the object on which the receiver will operate (for either the get or set operation) if this method returns true.
Returns:
This method always returns true. Subclasses of FieldValueAccessor which implement different accessors for different instances of the same class will need to override this and return the approiate value.


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