Class ComponentConfig<T>

java.lang.Object
org.apache.tika.serialization.ComponentConfig<T>
Type Parameters:
T - the component type (e.g., Parser, Detector)

public class ComponentConfig<T> extends Object
Configuration for how to load a top-level component from JSON.

Specifies:

  • The JSON field name (e.g., "parsers", "detectors")
  • Whether to load as a list or single object
  • How to wrap a list into a composite object (e.g., List<Parser> → CompositeParser)
  • What default to return if the field is absent
  • Optional custom loader for complex components
  • Method Details

    • getJsonField

      public String getJsonField()
    • getComponentClass

      public Class<T> getComponentClass()
    • isLoadAsList

      public boolean isLoadAsList()
    • wrapList

      public T wrapList(List<?> list)
    • hasListWrapper

      public boolean hasListWrapper()
    • getDefault

      public T getDefault()
    • hasDefault

      public boolean hasDefault()
    • hasCustomLoader

      public boolean hasCustomLoader()
      Returns true if this component has a custom loader.
    • getCustomLoader

      public ComponentLoader<T> getCustomLoader()
      Gets the custom loader for this component.
    • builder

      public static <T> ComponentConfig.Builder<T> builder(String jsonField, Class<T> componentClass)
      Creates a new builder for ComponentConfig.
      Parameters:
      jsonField - the JSON field name (e.g., "parsers")
      componentClass - the component interface (e.g., Parser.class)
      Returns:
      a new builder