com.ashridgetech.jamda.uml
Class Holder

java.lang.Object
  |
  +--com.ashridgetech.jamda.uml.Holder

public final class Holder
extends java.lang.Object

Utility class to hold an Object which may not be initialised until required. It may be set with a null value, but this can be distinguished from an 'unset' state. The set(java.lang.Object) method must be called before the get() method, and set(java.lang.Object) may only be called once.

Version:
1.0
Author:
paulb

Constructor Summary
Holder()
           
 
Method Summary
 java.lang.Object get()
          Gets the value of this Holder
 boolean isSet()
          Shows whether the value of this Holder has been set
 void set(java.lang.Object value)
          Sets the value of this Holder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Holder

public Holder()
Method Detail

get

public java.lang.Object get()
Gets the value of this Holder

Returns:
the value
Throws:
java.lang.IllegalStateException - if set(java.lang.Object) has not been called yet

set

public void set(java.lang.Object value)
Sets the value of this Holder

Parameters:
value - the value to store
Throws:
java.lang.IllegalStateException - if set(java.lang.Object) has already been called

isSet

public boolean isSet()
Shows whether the value of this Holder has been set

Returns:
true if the value is set
See Also:
set(java.lang.Object)


Copyright © 2003 Ashridge Technologies Ltd. All Rights Reserved.