Class LockableField<T>

java.lang.Object
net.minheur.potoflux.utils.LockableField<T>
Type Parameters:
T - the actual Object stored by the field

public class LockableField<T> extends Object
This defines a random object, but it can be locked (so unchangeable)
  • Constructor Details

    • LockableField

      public LockableField(T data, boolean locked)
      Creates a field, with the initial value and if it is locked
      Parameters:
      data - initial value, of type LockableField
      locked - weather the value is locked
  • Method Details

    • get

      public T get()
      Gets the stored value
      Returns:
      data
    • set

      public boolean set(T value)
      Sets the value, if it is not locked
      Parameters:
      value - new value of the field
      Returns:
      weather it been set. false if locked
    • getIsLocked

      public boolean getIsLocked()
      Checks if the field is locked
      Returns:
      locked