Package org.robovm.rt.bro
Class LazyGlobalValue<T>
java.lang.Object
org.robovm.rt.bro.GlobalValueSupplier<T>
org.robovm.rt.bro.LazyGlobalValue<T>
public class LazyGlobalValue<T> extends GlobalValueSupplier<T>
Reads a
GlobalValue lazily and optionally caches the result.-
Constructor Summary
Constructors Constructor Description LazyGlobalValue(Class<?> owner, String getterName)Creates a new constantLazyGlobalValue.LazyGlobalValue(Class<?> owner, String getterName, boolean constant)Creates a newLazyGlobalValue. -
Method Summary
Modifier and Type Method Description booleanisAvailable()Returns true if global value is available (e.g.Tvalue()Returns the value of theGlobalValue.
-
Constructor Details
-
LazyGlobalValue
Creates a new constantLazyGlobalValue. The value will only be read once and that value will then always be returned byvalue().- Parameters:
owner- the class where theGlobalValuemethod is to be found.getterName- the name of theGlobalValuegetter method.
-
LazyGlobalValue
Creates a newLazyGlobalValue.- Parameters:
owner- the class where theGlobalValuemethod is to be found.getterName- the name of theGlobalValuegetter method.constant- iftruethe value will only read once and then cached.
-
-
Method Details
-
isAvailable
public boolean isAvailable()Description copied from class:GlobalValueSupplierReturns true if global value is available (e.g. there is no UnsatisfiedLinkError when accessing it)- Specified by:
isAvailablein classGlobalValueSupplier<T>- Returns:
- true if available
-
value
Returns the value of theGlobalValue.- Specified by:
valuein classGlobalValueSupplier<T>- Returns:
- the value.
-