FileDocCategorySizeDatePackage
ValueHolder.javaAPI DocGlassfish v2 API6010Tue May 22 16:54:20 BST 2007oracle.toplink.essentials.indirection

ValueHolder

public class ValueHolder extends Object implements Serializable, Cloneable, WeavedAttributeValueHolderInterface

Purpose: Act as a place holder for a variable that required a value holder interface. This class should be used to initialze an objects attributes that are using indirection is their mappings.

Fields Summary
protected Object
value
Stores the wrapped object.
private boolean
isCoordinatedWithProperty
The two variable below are used as part of the implementation of WeavedAttributeValueHolderInterface They are used to track whether a valueholder that has been weaved into a class is coordinated with the underlying property
private boolean
isNewlyWeavedValueHolder
Constructors Summary
public ValueHolder()
PUBLIC: Initialize the holder.

    
             
      
        super();
    
public ValueHolder(Object value)
PUBLIC: Initialize the holder with an object.

        this.value = value;
    
Methods Summary
public java.lang.Objectclone()
INTERNAL:

        try {
            return super.clone();
        } catch (CloneNotSupportedException exception) {
            ;
        }

        return null;
    
public synchronized java.lang.ObjectgetValue()
PUBLIC: Return the wrapped object.

        return value;
    
public booleanisCoordinatedWithProperty()
Used as part of the implementation of WeavedAttributeValueHolderInterface Used to track whether a valueholder that has been weaved into a class is coordinated with the underlying property

        return isCoordinatedWithProperty;
    
public booleanisInstantiated()
PUBLIC: Return a boolean indicating whether the wrapped object has been set or not.

        // Always return true since we consider 
        // null to be a valid wrapped object.
        return true;
    
public booleanisNewlyWeavedValueHolder()
Used as part of the implementation of WeavedAttributeValueHolderInterface Used to determine if this ValueHolder was added instantiated as part of the constructor of a weaved class

        return isNewlyWeavedValueHolder;
    
public voidsetIsCoordinatedWithProperty(boolean coordinated)
Used as part of the implementation of WeavedAttributeValueHolderInterface Used to track whether a valueholder that has been weaved into a class is coordinated with the underlying property This method will be called internall when the state of Coordination between the weaved valueholder and the underlying value is known

        this.isCoordinatedWithProperty = coordinated;
        // this is not a newly weaved valueholder any more since we have done some coordination work
        isNewlyWeavedValueHolder = false;
    
public voidsetIsNewlyWeavedValueHolder(boolean isNew)
Used as part of the implementation of WeavedAttributeValueHolderInterface Used to determine if this ValueHolder was added instantiated as part of the constructor of a weaved class This method will be called when a ValueHolder is instantiated in a weaved class

        this.isNewlyWeavedValueHolder = isNew;
    
public voidsetValue(java.lang.Object value)
PUBLIC: Set the wrapped object.

        this.value = value;
    
public java.lang.StringtoString()
INTERNAL:

        if (getValue() == null) {
            return "{" + null + "}";
        }
        return "{" + getValue().toString() + "}";