OGS Java API Spec

ogs.support
Interface Attachable


public interface Attachable

An object that can be attached to another object. While attached, a attachable may modify the object that it is attached to. These modifications should be reversible if and when the attachable is detached from the object.


Method Summary
 boolean attachObject(Object object)
          Attach this attachable to an object.
 boolean detachObject()
          Detach this attachable from an object.
 Object getObject()
          Determine the object that this attachable is currently attached to.
 

Method Detail

attachObject

public boolean attachObject(Object object)
Attach this attachable to an object. This function first determines whether this object can be attached to the specified object. This step usually checks whether the object is being attached to itself or whether it is already attached. If the object can be attached, this function then applies any modifications to the attached object and returns true. Otherwise, this function should simply return false.

Parameters:
object - Object to attach this attachable to.
Returns:
True if this attachable is attached to the object.

detachObject

public boolean detachObject()
Detach this attachable from an object. This function determines if this object is attached and, if so, whether it can be detached from the attached object. If it can, the function removes or otherwise reverses any modifications made to the attached object and returns true. Otherwise, the function returns false.

Returns:
True if this attachable is detached from the object.

getObject

public Object getObject()
Determine the object that this attachable is currently attached to. If the attachable is not currently attached to any object, this function returns null.

Returns:
Attached object or null if not attached.

OGS Java API Spec