Package org.apache.groovy.util
Class ObjectHolder<T>
java.lang.Object
org.apache.groovy.util.ObjectHolder<T>
- Type Parameters:
T- the type of object
Just hold an object
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty holder.ObjectHolder(T object) Creates a holder with an initial object. -
Method Summary
-
Constructor Details
-
ObjectHolder
public ObjectHolder()Creates an empty holder. -
ObjectHolder
Creates a holder with an initial object.- Parameters:
object- the initial object
-
-
Method Details
-
getObject
Returns the currently held object.- Returns:
- the held object
-
getObject
Returns the currently held object, initializing it from the supplier when needed.- Parameters:
def- the supplier used when no object has been set- Returns:
- the held object
-
setObject
Replaces the currently held object.- Parameters:
object- the object to hold
-