edu.vub.at.objects
Interface Field


 Field

ATField provides a mapping from an immutable name to a potentially mutable value.

Note that when field objects are added to an Object and then that object is cloned, the field object will be re-instantiated (i.e. its 'new' method is invoked). This implies that any object implementing ATField should provide a meta_newInstance method whose sole initarg is the new host for the field.

Author:
smostinc

Method Summary
 Method accessor()
           
 Method mutator()
           
 Symbol name()
          Returns a string by which the slot can be identified.
 Object readField()
          Returns the current value of the field.
 Object writeField(Object newValue)
          Sets the value of the field if possible.
 
Methods inherited from interface edu.vub.at.objects.Object
super
 

Method Detail

name

Symbol name()
Returns a string by which the slot can be identified.

Returns:
a Symbol representing the string by which the slot can be identified.

readField

Object readField()
Returns the current value of the field.

Returns:
an Object representing the current value of the field.
Throws:
XIllegalOperation - if the field accessed is not found.

writeField

Object writeField(Object newValue)
Sets the value of the field if possible.

Parameters:
newValue - the value the field should hold.
Returns:
by default, the new value
Throws:
edu.vub.at.exceptions.InterpreterException - if the field cannot be modified.

accessor

Method accessor()
Returns:
an accessor method (slot) that, upon invocation, reads this field's value.

mutator

Method mutator()
Returns:
a mutator method (slot) that, upon invocation, sets this field's value to its single argument.