Class JsonIo.ToonStringBuilder

java.lang.Object
com.cedarsoftware.io.JsonIo.ToonStringBuilder
Enclosing class:
JsonIo

public static final class JsonIo.ToonStringBuilder extends Object
Builder for converting a TOON string to Java objects.

This builder completes the TOON parsing process started by JsonIo.fromToon(String, ReadOptions). It provides methods to specify the target type for the deserialization.

  • Method Details

    • asClass

      public <T> T asClass(Class<T> clazz)
      Completes the TOON parsing by specifying a target class.
      Type Parameters:
      T - the type to convert the TOON to
      Parameters:
      clazz - the target class; if null, the type will be inferred from the TOON
      Returns:
      an instance of the specified class populated from the TOON
      Throws:
      JsonIoException - if an error occurs during parsing or conversion
    • asType

      public <T> T asType(TypeHolder<T> typeHolder)
      Completes the TOON parsing by specifying a generic type.
      Type Parameters:
      T - the type to convert the TOON to
      Parameters:
      typeHolder - a TypeHolder instance capturing the full generic type
      Returns:
      an object of the specified type populated from the TOON
      Throws:
      JsonIoException - if an error occurs during parsing or conversion