Class DynamicOps<T>

java.lang.Object
com.github.darksoulq.abyssallib.common.serialization.DynamicOps<T>
Type Parameters:
T - The base type of the serialized format (e.g., JsonElement, ConfigurationSection).
Direct Known Subclasses:
ByteOps, JsonOps, NbtOps, StringOps, YamlOps

public abstract class DynamicOps<T> extends Object
Defines a set of operations for a specific serialized format (e.g., JSON, YAML, NBT). This abstraction allows Codecs to remain format-agnostic.
  • Constructor Details

    • DynamicOps

      public DynamicOps()
  • Method Details

    • createString

      public abstract T createString(String value)
      Parameters:
      value - String value.
      Returns:
      Serialized string.
    • createInt

      public abstract T createInt(int value)
      Parameters:
      value - Integer value.
      Returns:
      Serialized int.
    • createLong

      public abstract T createLong(long value)
      Parameters:
      value - Long value.
      Returns:
      Serialized long.
    • createFloat

      public abstract T createFloat(float value)
      Parameters:
      value - Float value.
      Returns:
      Serialized float.
    • createDouble

      public abstract T createDouble(double value)
      Parameters:
      value - Double value.
      Returns:
      Serialized double.
    • createBoolean

      public abstract T createBoolean(boolean value)
      Parameters:
      value - Boolean value.
      Returns:
      Serialized boolean.
    • createList

      public abstract T createList(List<T> elements)
      Parameters:
      elements - List of serialized elements.
      Returns:
      Serialized list.
    • createMap

      public abstract T createMap(Map<T,T> map)
      Parameters:
      map - Map of serialized key-value pairs.
      Returns:
      Serialized map.
    • getStringValue

      public abstract Optional<String> getStringValue(T input)
      Parameters:
      input - Serialized input.
      Returns:
      Optional string value.
    • getIntValue

      public abstract Optional<Integer> getIntValue(T input)
      Parameters:
      input - Serialized input.
      Returns:
      Optional integer value.
    • getLongValue

      public abstract Optional<Long> getLongValue(T input)
      Parameters:
      input - Serialized input.
      Returns:
      Optional long value.
    • getFloatValue

      public abstract Optional<Float> getFloatValue(T input)
      Parameters:
      input - Serialized input.
      Returns:
      Optional float value.
    • getDoubleValue

      public abstract Optional<Double> getDoubleValue(T input)
      Parameters:
      input - Serialized input.
      Returns:
      Optional double value.
    • getBooleanValue

      public abstract Optional<Boolean> getBooleanValue(T input)
      Parameters:
      input - Serialized input.
      Returns:
      Optional boolean value.
    • getList

      public abstract Optional<List<T>> getList(T input)
      Parameters:
      input - Serialized input.
      Returns:
      Optional list of elements.
    • getMap

      public abstract Optional<Map<T,T>> getMap(T input)
      Parameters:
      input - Serialized input.
      Returns:
      Optional map of elements.
    • empty

      public abstract T empty()
      Returns:
      An object representing a "null" or "empty" state in the serialized format.