cz.cuni.amis.utils
Class Lazy<T>

Package class diagram package Lazy
java.lang.Object
  extended by cz.cuni.amis.utils.Lazy<T>
Direct Known Subclasses:
SyncLazy

public abstract class Lazy<T>
extends Object

Utility class for lazy initialization of objects.

THREAD-UNSAFE!

Author:
ik

Field Summary
protected  T obj
           
 
Constructor Summary
Lazy()
           
 
Method Summary
protected abstract  T create()
          Creates lazy initialized object.
 T get()
          Synonym for getVal().
 T getVal()
          Deprecated.  
 void set(T val)
          Sets value that should be returned via get().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

obj

protected T obj
Constructor Detail

Lazy

public Lazy()
Method Detail

create

protected abstract T create()
Creates lazy initialized object.

Returns:

getVal

public T getVal()
Deprecated. 

Returns:
value created by create() (UNSYNCHRONIZED CREATION!)

get

public T get()
Synonym for getVal().

Returns:

set

public void set(T val)
Sets value that should be returned via get().

Parameters:
val -


Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.