public abstract class LazyInitializer<T> extends Object
LazyInitializer, which doesn't throw any checked exception when get method is invoked.| Modifier and Type | Field and Description |
|---|---|
protected T |
object
Stores the managed object.
|
| Constructor and Description |
|---|
LazyInitializer() |
| Modifier and Type | Method and Description |
|---|---|
T |
get()
Returns the object wrapped by this instance.
|
protected abstract T |
initialize()
Creates and initializes the object managed by this
LazyInitializer. |
boolean |
isInitialized() |
protected volatile T object
public final T get()
LazyInitializer the objectpublic final boolean isInitialized()
protected abstract T initialize()
LazyInitializer. This method is called by get()
when the object is accessed for the first time. An implementation can focus on the creation of the object. No
synchronization is needed, as this is already handled by get().Copyright © 2008-2014. All Rights Reserved.