Class ConfigObjectProperty<T>

java.lang.Object
net.darkhax.pricklemc.common.api.config.property.ObjectProperty<T>
net.darkhax.pricklemc.common.api.config.property.ConfigObjectProperty<T>
Type Parameters:
T - The type of the config property.
All Implemented Interfaces:
IConfigProperty<T>

public class ConfigObjectProperty<T> extends ObjectProperty<T>
A config property that contains an object of sub-properties.
  • Method Details

    • writeValue

      public void writeValue(T value, com.google.gson.stream.JsonWriter writer, PropertyResolver resolver, org.slf4j.Logger logger) throws IOException
      Description copied from class: ObjectProperty
      Writes a value to the JSON writer.
      Overrides:
      writeValue in class ObjectProperty<T>
      Parameters:
      value - The value to be written.
      writer - A writer to write JSON data to.
      resolver - Resolves properties with GSON or config properties.
      logger - A log instance used to log warnings and errors encountered when saving the value.
      Throws:
      IOException - A fatal exception may be thrown if the value could not be written.
    • read

      public void read(com.google.gson.stream.JsonReader reader, PropertyResolver resolver, org.slf4j.Logger logger) throws IOException
      Description copied from interface: IConfigProperty
      Reads the value from the JSON and applies it to the parent object.
      Specified by:
      read in interface IConfigProperty<T>
      Overrides:
      read in class ObjectProperty<T>
      Parameters:
      reader - A reader containing a stream of JSON data.
      resolver - Resolves properties with GSON or config properties.
      logger - A log instance used to log warnings and errors encountered when the value is read.
      Throws:
      IOException - Fatal errors should be thrown if invalid data is encountered.
    • adapter

      public static IPropertyAdapter<?> adapter(PropertyResolver resolver)
      Creates a new adapter using a specific property resolver. This ensures the GSON instance and the type adapter options are passed to the sub properties.
      Parameters:
      resolver - The property resolver.
      Returns:
      An adapter that can handle config properties that are held as sub properties.