Package com.google.gerrit.server.rules
Class StoredValue<T>
- java.lang.Object
-
- com.google.gerrit.server.rules.StoredValue<T>
-
public class StoredValue<T> extends Object
Defines a value cached in aPrologEnvironment
.- See Also:
StoredValues
-
-
Constructor Summary
Constructors Constructor Description StoredValue()
Initializes a stored value key with a new unique key.StoredValue(Object key)
Initialize a stored value key using any Java Object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> StoredValue<T>
create()
Construct a new unique key that does not match any other key.static <T> StoredValue<T>
create(Class<T> clazz)
Construct a key based on a Java Class object, useful for singletons.protected T
createValue(com.googlecode.prolog_cafe.lang.Prolog engine)
Creates a value to store, returns null by default.T
get(PrologEnvironment env)
PerformgetOrNull(Prolog)
on the environment's interpreter.T
get(com.googlecode.prolog_cafe.lang.Prolog engine)
Get the value from the engine, or throw SystemException.T
getOrNull(com.googlecode.prolog_cafe.lang.Prolog engine)
Look up the value in the engine, or return null.void
set(PrologEnvironment env, T obj)
Set the value into the environment's interpreter.void
set(com.googlecode.prolog_cafe.lang.Prolog engine, T obj)
-
-
-
Constructor Detail
-
StoredValue
public StoredValue(Object key)
Initialize a stored value key using any Java Object.- Parameters:
key
- unique identity of the stored value. This will be the hash key in the Prolog Environments's hash map.
-
StoredValue
public StoredValue()
Initializes a stored value key with a new unique key.
-
-
Method Detail
-
create
public static <T> StoredValue<T> create()
Construct a new unique key that does not match any other key.
-
create
public static <T> StoredValue<T> create(Class<T> clazz)
Construct a key based on a Java Class object, useful for singletons.
-
getOrNull
public T getOrNull(com.googlecode.prolog_cafe.lang.Prolog engine)
Look up the value in the engine, or return null.
-
get
public T get(com.googlecode.prolog_cafe.lang.Prolog engine)
Get the value from the engine, or throw SystemException.
-
set
public void set(com.googlecode.prolog_cafe.lang.Prolog engine, T obj)
-
get
public T get(PrologEnvironment env)
PerformgetOrNull(Prolog)
on the environment's interpreter.
-
set
public void set(PrologEnvironment env, T obj)
Set the value into the environment's interpreter.
-
createValue
protected T createValue(com.googlecode.prolog_cafe.lang.Prolog engine)
Creates a value to store, returns null by default.- Parameters:
engine
- Prolog engine.- Returns:
- new value.
-
-