Class NestedText.Reader

java.lang.Object
org.loxlylabs.nestedtext.NestedText.Reader
Enclosing class:
NestedText

public final class NestedText.Reader extends Object
An intermediate object used to specify the target type for the parsed NestedText data.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    as(Class<T> targetClass)
    Completes the deserialization by converting the parsed data into the specified type.
    <T> T
    as(TypeReference<T> typeRef)
    Completes the deserialization by converting the parsed data into the specified generic type.
    Returns the raw, untyped result of the parsing operation (a Map, List, or String).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • as

      public <T> T as(Class<T> targetClass)
      Completes the deserialization by converting the parsed data into the specified type.
      Type Parameters:
      T - The target type.
      Parameters:
      targetClass - The class to convert to.
      Returns:
      An instance of the target type.
    • as

      public <T> T as(TypeReference<T> typeRef)
      Completes the deserialization by converting the parsed data into the specified generic type.
      Type Parameters:
      T - The target type.
      Parameters:
      typeRef - A TypeReference capturing the generic type.
      Returns:
      An instance of the target type.
    • asObject

      public Object asObject()
      Returns the raw, untyped result of the parsing operation (a Map, List, or String).

      Note: This method returns the direct output of the parser and does NOT apply any type-specific mapping rules (e.g., field renaming or ignoring).

      Returns:
      The untyped object.