fr.jussieu.gla.wasa.util
Class PropertyVar

java.lang.Object
  |
  +--fr.jussieu.gla.wasa.core.Var
        |
        +--fr.jussieu.gla.wasa.util.PropertyVar

public final class PropertyVar
extends Var

Var object acessing to a Buisness Object's value using reflection, supposing that the value is of an immutable type. 'Real world' applications should avoid using this implementation of Var since reflexion is slower than overriding Var.getReferencedValue(), Var.setReferencedValue( Object ), and Var.cloneValue().

Version:
$Revision: 1.2 $ $Date: 2002/03/29 18:46:33 $
Author:
Laurent Caillette, Florent Selva

Constructor Summary
PropertyVar(Explorer explorer, java.lang.Object bean, java.lang.reflect.Method getter, java.lang.reflect.Method setter)
           
 
Method Summary
protected  java.lang.Object cloneValue()
          Override this method to provide custom cloning operation.
 java.lang.Object getReferencedValue()
          Override this method to provide the specific behavior for getting the reference to the value object hold by buisness object.
 boolean hasValueBasedHashCode()
          Returns if value's hashCode can be used to perform faster comparisons.
 void setReferencedValue(java.lang.Object value)
          Override this method to provide the specific behavior of updating the value object held by buisness object.
 
Methods inherited from class fr.jussieu.gla.wasa.core.Var
getError, getExplorer, getName, getRank, incError, incError, incError, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyVar

public PropertyVar(Explorer explorer,
                   java.lang.Object bean,
                   java.lang.reflect.Method getter,
                   java.lang.reflect.Method setter)
Method Detail

getReferencedValue

public java.lang.Object getReferencedValue()
Description copied from class: Var
Override this method to provide the specific behavior for getting the reference to the value object hold by buisness object.
Overrides:
getReferencedValue in class Var
Following copied from class: fr.jussieu.gla.wasa.core.Var
Returns:
A reference to the value object.

setReferencedValue

public void setReferencedValue(java.lang.Object value)
Description copied from class: Var
Override this method to provide the specific behavior of updating the value object held by buisness object.
Overrides:
setReferencedValue in class Var
Following copied from class: fr.jussieu.gla.wasa.core.Var
Parameters:
value - The value to set.

cloneValue

protected java.lang.Object cloneValue()
                               throws java.lang.CloneNotSupportedException
Description copied from class: Var
Override this method to provide custom cloning operation. The framework guarantees that it won't be called if value is null.
Overrides:
cloneValue in class Var
Following copied from class: fr.jussieu.gla.wasa.core.Var
Returns:
A clone of value object.
Throws:
java.lang.CloneNotSupportedException - as Object.clone() does.

hasValueBasedHashCode

public boolean hasValueBasedHashCode()
Description copied from class: Var
Returns if value's hashCode can be used to perform faster comparisons.

Override this method to return true if you are sure the value object has significant hash code, in other words it respects this part of the hashCode contract :
If two objects are equal according to the equals( Object ) method, then calling the hashCode method on each of the two objects must produce the same integer result.

Overrides:
hasValueBasedHashCode in class Var
Returns:
true since PropertyVar is mainly designed to map properties with immutable type.