Package com.globalmentor.model
Class ObjectHolder<T>
- java.lang.Object
-
- com.globalmentor.model.AbstractObjectDecorator<T>
-
- com.globalmentor.model.ObjectHolder<T>
-
- Type Parameters:
T
- The type of object being held.
- Direct Known Subclasses:
ReadWriteLockObjectHolder
public class ObjectHolder<T> extends AbstractObjectDecorator<T>
An object that holds another object.- Author:
- Garret Wilson
-
-
Constructor Summary
Constructors Constructor Description ObjectHolder()
Default constructor to holdnull
.ObjectHolder(T object)
Held object constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
getObject()
boolean
isPresent()
void
setObject(T object)
Sets the held object.-
Methods inherited from class com.globalmentor.model.AbstractObjectDecorator
equals, hashCode, toString
-
-
-
-
Constructor Detail
-
ObjectHolder
public ObjectHolder()
Default constructor to holdnull
.
-
ObjectHolder
public ObjectHolder(T object)
Held object constructor.- Parameters:
object
- The object to hold.
-
-
Method Detail
-
getObject
public T getObject()
- Overrides:
getObject
in classAbstractObjectDecorator<T>
- Returns:
- The held object.
-
setObject
public void setObject(T object)
Sets the held object.- Overrides:
setObject
in classAbstractObjectDecorator<T>
- Parameters:
object
- The object to hold.
-
isPresent
public boolean isPresent()
- Returns:
true
if the object being held is not equal tonull
.
-
-