blackboard.data
Interface Immutable


public interface Immutable

The Immutable interface defines a means for specifying an object that can be made immutable. Any object imlementing this interface is initially mutable, and any "set" method on the object can be called. However, after the object is "marked" as being complete (through a call to setComplete()) any attempt to call a "set" method throws an ImmutableException.

Once an object is marked as complete, it becomes immutable, and can not be changed back to a mutable state for the life of the object. However, the clone of an immutable object (created through Object.clone() if cloning of the object is supported) will be mutable (i.e., the immutable state of an object is not cloned).

example:

 ImmutableObject foo = new ImmutableObject();
 foo.setFoo( "foo" );  <-- OKAY.
 foo.setComplete();    <-- OKAY.  Makes foo immutable
 foo.setFoo( "bar" );  <-- ERROR.  Throws ImmutableException
 

Since:
Bb 5.5
Version:
$Revision: #1 $ $Date: 2005/06/27 $

Method Summary
 void setComplete()
          Marks the object implementing this interface as being immutable such that any attempt to change the state of the object (through a "set" method), results in an ImmutableException being thrown.
 

Method Detail

setComplete

void setComplete()
Marks the object implementing this interface as being immutable such that any attempt to change the state of the object (through a "set" method), results in an ImmutableException being thrown. Prior to a call being made to this method, the implementing object is considered to be mutable.



Copyright © 2003 Blackboard, Inc. All Rights Reserved.