T- the type of the object managed by this initializer
public class ConstantInitializer<T> extends java.lang.Object implements ConcurrentInitializer<T>
A very simple implementation of the
which always returns the same object.
An instance of this class is passed a reference to an object when it is
get() method just returns this object. No
synchronization is required.
This class is useful for instance for unit testing or in cases where a
specific object has to be passed to an object which expects a
|Constructor and Description|
Creates a new instance of
|Modifier and Type||Method and Description|
Compares this object with another one.
Returns the object managed by this initializer.
Directly returns the object that was passed to the constructor.
Returns a hash code for this object.
Returns a string representation for this object.
public ConstantInitializer(T obj)
ConstantInitializerand initializes it with the object to be managed. The
get()method will always return the object passed here. This class does not place any restrictions on the object. It may be null, then
get()will return null, too.
obj- the object to be managed by this initializer
public final T getObject()
get(). However, this method does not declare that it throws an exception.
public T get() throws ConcurrentException
public int hashCode()
public boolean equals(java.lang.Object obj)
ConstantInitializerwhich refers to an object equals to the object managed by this instance.
obj- the object to compare to
public java.lang.String toString()
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"