Class KlumJacksonImporter

java.lang.Object
com.blackbuild.klum.ast.jackson.KlumJacksonImporter

public final class KlumJacksonImporter extends Object
Explicit, Builder-first Jackson import operations.

The importer captures one untyped ObjectReader; it never mutates a mapper or registers a module. Configure Jackson, including KlumAstModule, before creating it. Each method consumes exactly one KlumJacksonInput; parser lifecycle remains with the caller.

  • Method Summary

    Modifier and Type
    Method
    Description
    <B extends com.blackbuild.klum.ast.runtime.KlumBuilder<?>>
    B
    applyToBuilder(B builder, KlumJacksonInput input)
    Applies one input to the same unsealed Builder in its active Construction session.
    <T, B extends com.blackbuild.klum.ast.runtime.KlumBuilder<T>>
    B
    readBuilder(com.blackbuild.klum.ast.runtime.KlumFactory.BuilderFactory<T,B> factory, KlumJacksonInput input)
    Reads one owned Builder in the current Construction session without materializing it.
    <T> T
    readRoot(Class<T> type, KlumJacksonInput input)
    Reads one root DSL Object through its normal Builder lifecycle.
    <T> T
    Reads a value-only Template without running lifecycle callbacks or phases.
    using(com.fasterxml.jackson.databind.ObjectMapper mapper)
    Captures ObjectMapper.reader() once without changing the mapper.
    using(com.fasterxml.jackson.databind.ObjectReader reader)
    Captures an untyped, non-updating reader while preserving all of its caller configuration.

    Methods inherited from class java.lang.Object

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

    • using

      public static KlumJacksonImporter using(com.fasterxml.jackson.databind.ObjectMapper mapper)
      Captures ObjectMapper.reader() once without changing the mapper.
      Parameters:
      mapper - caller-configured mapper
      Returns:
      immutable importer using the mapper's current reader configuration
    • using

      public static KlumJacksonImporter using(com.fasterxml.jackson.databind.ObjectReader reader)
      Captures an untyped, non-updating reader while preserving all of its caller configuration.
      Parameters:
      reader - caller-configured untyped reader
      Returns:
      immutable importer retaining that reader
      Throws:
      IllegalArgumentException - if the reader is typed or updates an existing value
    • readRoot

      public <T> T readRoot(Class<T> type, KlumJacksonInput input)
      Reads one root DSL Object through its normal Builder lifecycle.
      Type Parameters:
      T - completed DSL model type
      Parameters:
      type - DSL model type
      input - one caller-owned Jackson input
      Returns:
      the completed root model
    • readTemplate

      public <T> T readTemplate(Class<T> type, KlumJacksonInput input)
      Reads a value-only Template without running lifecycle callbacks or phases.
      Type Parameters:
      T - completed DSL model type
      Parameters:
      type - DSL model type
      input - one caller-owned Jackson input
      Returns:
      marked value-only Template
    • readBuilder

      public <T, B extends com.blackbuild.klum.ast.runtime.KlumBuilder<T>> B readBuilder(com.blackbuild.klum.ast.runtime.KlumFactory.BuilderFactory<T,B> factory, KlumJacksonInput input)
      Reads one owned Builder in the current Construction session without materializing it.
      Type Parameters:
      T - DSL model type
      B - precise generated Builder type
      Parameters:
      factory - generated Builder-producing factory
      input - one caller-owned Jackson input
      Returns:
      unsealed Builder from the active session
    • applyToBuilder

      public <B extends com.blackbuild.klum.ast.runtime.KlumBuilder<?>> B applyToBuilder(B builder, KlumJacksonInput input)
      Applies one input to the same unsealed Builder in its active Construction session.
      Type Parameters:
      B - precise Builder type
      Parameters:
      builder - active unsealed Builder
      input - one caller-owned Jackson input
      Returns:
      the identical Builder instance