Class CompactConstructor

Direct Known Subclasses:
PackageCompactConstructor

public class CompactConstructor extends Constructor
Construct a custom Java instance out of a compact object notation format.
  • Field Details

    • GUESS_COMPACT

      private static final Pattern GUESS_COMPACT
    • FIRST_PATTERN

      private static final Pattern FIRST_PATTERN
    • PROPERTY_NAME_PATTERN

      private static final Pattern PROPERTY_NAME_PATTERN
    • compactConstruct

      private Construct compactConstruct
  • Constructor Details

    • CompactConstructor

      public CompactConstructor(LoaderOptions loadingConfig)
      Create with provided options
      Parameters:
      loadingConfig - - options
    • CompactConstructor

      public CompactConstructor()
      Create with defaults
  • Method Details

    • constructCompactFormat

      protected Object constructCompactFormat(ScalarNode node, CompactData data)
    • createInstance

      protected Object createInstance(ScalarNode node, CompactData data) throws Exception
      Throws:
      Exception
    • setProperties

      protected void setProperties(Object bean, Map<String,Object> data) throws Exception
      Throws:
      Exception
    • getCompactData

      public CompactData getCompactData(String scalar)
    • getCompactConstruct

      private Construct getCompactConstruct()
      Create if it does not exist
      Returns:
      instance
    • createCompactConstruct

      protected Construct createCompactConstruct()
      Create
      Returns:
      new instance
    • getConstructor

      protected Construct getConstructor(Node node)
      Description copied from class: BaseConstructor
      Get the constructor to construct the Node. For implicit tags if the runtime class is known a dedicated Construct implementation is used. Otherwise, the constructor is chosen by the tag.
      Overrides:
      getConstructor in class BaseConstructor
      Parameters:
      node - Node to construct an instance from
      Returns:
      Construct implementation for the specified node
    • applySequence

      protected void applySequence(Object bean, List<?> value)
    • getSequencePropertyName

      protected String getSequencePropertyName(Class<?> bean)
      Provide the name of the property which is used when the entries form a sequence. The property must be a List.
      Parameters:
      bean - the class to provide exactly one List property
      Returns:
      name of the List property