Interface Reference


public interface Reference
A reference that uniquely identifies or addresses as specific Container.

References are generic in nature, treating the field names and values as strings. While names are expected to be case-insensitive, no other requirements are in place regarding their types and ordering.

  • Method Summary

    Modifier and Type
    Method
    Description
    default Reference
    extend(String name, String value)
    Deprecated.
    Returns the fields defined by this reference.
    get(String field)
    Returns the value associated with the given field.
    default boolean
    Returns true if this references the root container.
    static String
    Produces a normalized version of a string that allows for case-insensitive operations.
    static Reference
    of(String name, boolean value)
    Constructs a reference containing the given field name and value.
    static Reference
    of(String name, byte... values)
    Constructs a reference containing the given field name and value.
    static Reference
    of(String name, double... values)
    Constructs a reference containing the given field name and value.
    static Reference
    of(String name, float... values)
    Constructs a reference containing the given field name and value.
    static Reference
    of(String name, int... values)
    Constructs a reference containing the given field name and value.
    static Reference
    of(String name, long... values)
    Constructs a reference containing the given field name and value.
    static Reference
    of(String name, short... values)
    Constructs a reference containing the given field name and value.
    static Reference
    of(String name, String value)
    Constructs a reference containing the given field name and value.
    static <T extends Enum<?>>
    Reference
    of(String name, T value)
    Constructs a reference containing the given field name and value.
    static Reference
    of(TypedProperties properties)
    Constructs a reference with all the keys and values contained in a TypedProperties.
    static Reference
    Constructs a reference to the root container.
    default String
    Returns this reference formatted as JSON.
    default Reference
    with(String name, boolean value)
    Creates a new reference with the designated field name added or overwritten with the given value.
    default Reference
    with(String name, byte... values)
    Creates a new reference with the designated field name added or overwritten with the given value.
    default Reference
    with(String name, double... values)
    Creates a new reference with the designated field name added or overwritten with the given value.
    default Reference
    with(String name, float... values)
    Creates a new reference with the designated field name added or overwritten with the given value.
    default Reference
    with(String name, int... values)
    Creates a new reference with the designated field name added or overwritten with the given value.
    default Reference
    with(String name, long... values)
    Creates a new reference with the designated field name added or overwritten with the given value.
    default Reference
    with(String name, short... values)
    Creates a new reference with the designated field name added or overwritten with the given value.
    default Reference
    with(String name, String value)
    Creates a new reference with the designated field name added or overwritten with the given value.
    default <T extends Enum<?>>
    Reference
    with(String name, T value)
    Creates a new reference with the designated field name added or overwritten with the given value.
  • Method Details

    • fields

      Set<String> fields()
      Returns the fields defined by this reference.
      Returns:
      the field names
    • get

      String get(String field)
      Returns the value associated with the given field.
      Parameters:
      field - the field name
      Returns:
      the value associated with the field
    • isRoot

      default boolean isRoot()
      Returns true if this references the root container. See DataStore.getRootContainer() for more details.
      Returns:
      true if this references the root container; false otherwise
    • toJSON

      default String toJSON()
      Returns this reference formatted as JSON.
      Returns:
      the JSON representation
    • extend

      @Deprecated default Reference extend(String name, String value)
      Deprecated.
      Extends this reference, adding or overwriting one field with a new value.
      Parameters:
      name - the field name
      value - the new value
      Returns:
      a new reference with this modification
    • with

      default Reference with(String name, byte... values)
      Creates a new reference with the designated field name added or overwritten with the given value. The value can either be a single value or an array.
      Parameters:
      name - the new or overwritten field name
      values - the new value(s) assigned to the field
      Returns:
      a new reference with this modification
    • with

      default Reference with(String name, short... values)
      Creates a new reference with the designated field name added or overwritten with the given value. The value can either be a single value or an array.
      Parameters:
      name - the new or overwritten field name
      values - the new value(s) assigned to the field
      Returns:
      a new reference with this modification
    • with

      default Reference with(String name, int... values)
      Creates a new reference with the designated field name added or overwritten with the given value. The value can either be a single value or an array.
      Parameters:
      name - the new or overwritten field name
      values - the new value(s) assigned to the field
      Returns:
      a new reference with this modification
    • with

      default Reference with(String name, long... values)
      Creates a new reference with the designated field name added or overwritten with the given value. The value can either be a single value or an array.
      Parameters:
      name - the new or overwritten field name
      values - the new value(s) assigned to the field
      Returns:
      a new reference with this modification
    • with

      default Reference with(String name, float... values)
      Creates a new reference with the designated field name added or overwritten with the given value. The value can either be a single value or an array.
      Parameters:
      name - the new or overwritten field name
      values - the new value(s) assigned to the field
      Returns:
      a new reference with this modification
    • with

      default Reference with(String name, double... values)
      Creates a new reference with the designated field name added or overwritten with the given value. The value can either be a single value or an array.
      Parameters:
      name - the new or overwritten field name
      values - the new value(s) assigned to the field
      Returns:
      a new reference with this modification
    • with

      default Reference with(String name, String value)
      Creates a new reference with the designated field name added or overwritten with the given value.
      Parameters:
      name - the new or overwritten field name
      value - the new value assigned to the field
      Returns:
      a new reference with this modification
    • with

      default Reference with(String name, boolean value)
      Creates a new reference with the designated field name added or overwritten with the given value.
      Parameters:
      name - the new or overwritten field name
      value - the new value assigned to the field
      Returns:
      a new reference with this modification
    • with

      default <T extends Enum<?>> Reference with(String name, T value)
      Creates a new reference with the designated field name added or overwritten with the given value.
      Type Parameters:
      T - the enum type
      Parameters:
      name - the new or overwritten field name
      value - the new value assigned to the field
      Returns:
      a new reference with this modification
    • of

      static Reference of(TypedProperties properties)
      Constructs a reference with all the keys and values contained in a TypedProperties.
      Parameters:
      properties - the typed properties object
      Returns:
      a new reference based on the keys and values in the properties
    • of

      static Reference of(String name, byte... values)
      Constructs a reference containing the given field name and value. The value can either be a single value or an array.
      Parameters:
      name - the field name
      values - the value(s) assigned to the field
      Returns:
      a new reference based on the name and value
    • of

      static Reference of(String name, short... values)
      Constructs a reference containing the given field name and value. The value can either be a single value or an array.
      Parameters:
      name - the field name
      values - the value(s) assigned to the field
      Returns:
      a new reference based on the name and value
    • of

      static Reference of(String name, int... values)
      Constructs a reference containing the given field name and value. The value can either be a single value or an array.
      Parameters:
      name - the field name
      values - the value(s) assigned to the field
      Returns:
      a new reference based on the name and value
    • of

      static Reference of(String name, long... values)
      Constructs a reference containing the given field name and value. The value can either be a single value or an array.
      Parameters:
      name - the field name
      values - the value(s) assigned to the field
      Returns:
      a new reference based on the name and value
    • of

      static Reference of(String name, float... values)
      Constructs a reference containing the given field name and value. The value can either be a single value or an array.
      Parameters:
      name - the field name
      values - the value(s) assigned to the field
      Returns:
      a new reference based on the name and value
    • of

      static Reference of(String name, double... values)
      Constructs a reference containing the given field name and value. The value can either be a single value or an array.
      Parameters:
      name - the field name
      values - the value(s) assigned to the field
      Returns:
      a new reference based on the name and value
    • of

      static Reference of(String name, String value)
      Constructs a reference containing the given field name and value.
      Parameters:
      name - the field name
      value - the value assigned to the field
      Returns:
      a new reference based on the name and value
    • of

      static Reference of(String name, boolean value)
      Constructs a reference containing the given field name and value.
      Parameters:
      name - the field name
      value - the value assigned to the field
      Returns:
      a new reference based on the name and value
    • of

      static <T extends Enum<?>> Reference of(String name, T value)
      Constructs a reference containing the given field name and value.
      Type Parameters:
      T - the enum type
      Parameters:
      name - the field name
      value - the value assigned to the field
      Returns:
      a new reference based on the name and value
    • root

      static Reference root()
      Constructs a reference to the root container.
      Returns:
      a reference to the root container
    • normalize

      static String normalize(String str)
      Produces a normalized version of a string that allows for case-insensitive operations. This is based on the implementation of Apache Commons CaseInsensitiveMap.
      Parameters:
      str - the original string
      Returns:
      the normalized string
      See Also: