Class Bag

java.lang.Object
us.irdev.bedrock.bag.Bag
Direct Known Subclasses:
BagArray, BagObject

public abstract class Bag extends Object
  • Constructor Details

    • Bag

      public Bag()
  • Method Details

    • getObject

      public abstract Object getObject(String key)
      Parameters:
      key -
      Returns:
    • match

      public boolean match(BooleanExpr booleanExpr)
      Returns true if the Selectable matches the 'match' criteria
      Parameters:
      booleanExpr - a BooleanExpr containing criteria:
      Returns:
    • getString

      public String getString(String key)
      Retrieve a mapped element and return it as a String.
      Parameters:
      key - A string value used to index the element.
      Returns:
      The element as a string, or null if the element is not found (or not a String).
    • getString

      public String getString(String key, Supplier<String> notFound)
      Retrieve a mapped element and return it as a String.
      Parameters:
      key - A string value used to index the element.
      notFound - A function to create a new String if the requested key was not found
      Returns:
      The element as a string, or notFound if the element is not found.
    • getBagObject

      public BagObject getBagObject(String key)
      Retrieve a mapped element and return it as a BagObject.
      Parameters:
      key - A string value used to index the element.
      Returns:
      The element as a BagObject, or null if the element is not found.
    • getBagObject

      public BagObject getBagObject(String key, Supplier<BagObject> notFound)
      Retrieve a mapped element and return it as a BagObject.
      Parameters:
      key - A string value used to index the element.
      notFound - A function to create a new BagObject if the requested key was not found
      Returns:
      The element as a BagObject, or notFound if the element is not found.
    • getBagArray

      public BagArray getBagArray(String key)
      Retrieve a mapped element and return it as a BagArray.
      Parameters:
      key - A string value used to index the element.
      Returns:
      The element as a BagArray, or null if the element is not found.
    • getBagArray

      public BagArray getBagArray(String key, Supplier<BagArray> notFound)
      Retrieve a mapped element and return it as a BagArray.
      Parameters:
      key - A string value used to index the element.
      notFound - A function to create a new BagArray if the requested key was not found
      Returns:
      The element as a BagArray, or notFound if the element is not found.
    • getEnum

      public <EnumType extends Enum<EnumType>> EnumType getEnum(String key, Class<EnumType> type)
    • getEnum

      public <EnumType extends Enum<EnumType>> EnumType getEnum(String key, Class<EnumType> type, Supplier<EnumType> notFound)
    • getBoolean

      public Boolean getBoolean(String key)
      Retrieve a mapped element and return it as a Boolean.
      Parameters:
      key - A string value used to index the element.
      Returns:
      The element as a Boolean, or null if the element is not found.
    • getBoolean

      public Boolean getBoolean(String key, Supplier<Boolean> notFound)
      Retrieve a mapped element and return it as a Boolean.
      Parameters:
      key - A string value used to index the element.
      notFound - A function to create a new Boolean if the requested key was not found
      Returns:
      The element as a Boolean, or notFound if the element is not found.
    • getLong

      public Long getLong(String key)
      Retrieve a mapped element and return it as a Long.
      Parameters:
      key - A string value used to index the element.
      Returns:
      The element as a Long, or null if the element is not found.
    • getLong

      public Long getLong(String key, Supplier<Long> notFound)
      Retrieve a mapped element and return it as a Long.
      Parameters:
      key - A string value used to index the element.
      notFound - A function to create a new Long if the requested key was not found
      Returns:
      The element as a Long, or notFound if the element is not found.
    • getInteger

      public Integer getInteger(String key)
      Retrieve a mapped element and return it as an Integer.
      Parameters:
      key - A string value used to index the element.
      Returns:
      The element as an Integer, or null if the element is not found.
    • getInteger

      public Integer getInteger(String key, Supplier<Integer> notFound)
      Retrieve a mapped element and return it as an Integer.
      Parameters:
      key - A string value used to index the element.
      notFound - A function to create a new Integer if the requested key was not found
      Returns:
      The element as an Integer, or notFound if the element is not found.
    • getDouble

      public Double getDouble(String key)
      Retrieve a mapped element and return it as a Double.
      Parameters:
      key - A string value used to index the element.
      Returns:
      The element as a Double, or null if the element is not found.
    • getDouble

      public Double getDouble(String key, Supplier<Double> notFound)
      Retrieve a mapped element and return it as a Double.
      Parameters:
      key - A string value used to index the element.
      notFound - A function to create a new Double if the requested key was not found
      Returns:
      The element as a Double, or notFound if the element is not found.
    • getFloat

      public Float getFloat(String key)
      Retrieve a mapped element and return it as a Float.
      Parameters:
      key - A string value used to index the element.
      Returns:
      The element as a Float, or null if the element is not found.
    • getFloat

      public Float getFloat(String key, Supplier<Float> notFound)
      Retrieve a mapped element and return it as a Float.
      Parameters:
      key - A string value used to index the element.
      notFound - A function to create a new Float if the requested key was not found
      Returns:
      The element as a Float, or notFound if the element is not found.
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
      Parameters:
      object -
      Returns:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      Returns:
    • toString

      public abstract String toString(String format)
      Parameters:
      format -
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object