net.xqhs.graphs.util
Class ContentHolder<T>

java.lang.Object
  extended by net.xqhs.graphs.util.ContentHolder<T>
Type Parameters:
T - the type of the content.

public class ContentHolder<T>
extends java.lang.Object

The class serves as a mutable instance of type T. The user is able to get and set the content of the holder.

Author:
Andrei Olaru

Field Summary
protected  T theContent
          The content.
 
Constructor Summary
ContentHolder(T content)
          Creates a new content holder for type T, containing the content.
 
Method Summary
 T get()
          Returns the current content of the instance.
 ContentHolder<T> set(T content)
          Sets the current content of the instance.
 java.lang.String toString()
          Returns the result of the toString() of the content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

theContent

protected T theContent
The content.

Constructor Detail

ContentHolder

public ContentHolder(T content)
Creates a new content holder for type T, containing the content.

Parameters:
content - - the content to be held by the instance.
Method Detail

get

public T get()
Returns the current content of the instance.

Returns:
the content

set

public ContentHolder<T> set(T content)
Sets the current content of the instance.

Parameters:
content - - the content.
Returns:
the instance itself.

toString

public java.lang.String toString()
Returns the result of the toString() of the content.

Overrides:
toString in class java.lang.Object