org.omnaest.utils.structure.element
Class ElementHolderUnmodifiable<E>

java.lang.Object
  extended by org.omnaest.utils.structure.element.ElementHolderUnmodifiable<E>
Type Parameters:
E -
All Implemented Interfaces:
AccessorReadable<E>
Direct Known Subclasses:
ElementHolder

public class ElementHolderUnmodifiable<E>
extends Object
implements AccessorReadable<E>

Simple predefined ElementHolderUnmodifiable around an arbitrary element.

Author:
Omnaest
See Also:
ElementHolder

Field Summary
protected  E element
           
 
Constructor Summary
protected ElementHolderUnmodifiable()
           
  ElementHolderUnmodifiable(E element)
           
 
Method Summary
 E getElement()
          Returns the element the AccessorReadable does point to
 boolean hasElement()
          Returns true if the current element is not null
protected  ElementHolderUnmodifiable<E> setElement(E element)
          Sets the given element to the ElementHolderUnmodifiable
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

element

protected volatile E element
Constructor Detail

ElementHolderUnmodifiable

public ElementHolderUnmodifiable(E element)
Parameters:
element -

ElementHolderUnmodifiable

protected ElementHolderUnmodifiable()
See Also:
ElementHolderUnmodifiable
Method Detail

getElement

public E getElement()
Description copied from interface: AccessorReadable
Returns the element the AccessorReadable does point to

Specified by:
getElement in interface AccessorReadable<E>
Returns:
the element

hasElement

public boolean hasElement()
Returns true if the current element is not null

Returns:

setElement

protected ElementHolderUnmodifiable<E> setElement(E element)
Sets the given element to the ElementHolderUnmodifiable

Parameters:
element -
Returns:
this

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.