Package net.minheur.potoflux.utils
Class LockableField<T>
java.lang.Object
net.minheur.potoflux.utils.LockableField<T>
- Type Parameters:
T- the actual Object stored by the field
This defines a random object, but it can be locked (so unchangeable)
-
Constructor Summary
ConstructorsConstructorDescriptionLockableField(T data, boolean locked) Creates a field, with the initial value and if it is locked -
Method Summary
Modifier and TypeMethodDescriptionget()Gets the stored valuebooleanChecks if the field is lockedbooleanSets the value, if it is not locked
-
Constructor Details
-
LockableField
Creates a field, with the initial value and if it is locked- Parameters:
data- initial value, of type LockableFieldlocked- weather the value is locked
-
-
Method Details
-
get
Gets the stored value- Returns:
data
-
set
Sets the value, if it is not locked- Parameters:
value- new value of the field- Returns:
- weather it been set.
falseif locked
-
getIsLocked
public boolean getIsLocked()Checks if the field is locked- Returns:
locked
-