Class PropertiesTreeAdapter

java.lang.Object
io.micronaut.serde.properties.util.PropertiesTreeAdapter

@Internal @Singleton public class PropertiesTreeAdapter extends Object
Builds an intermediate JSON tree from flat Java .properties keys.

The tree-building algorithm is copied and adapted from Micronaut Core's JsonBeanPropertyBinder#buildSourceObjectNode(...). Bracketed array indexes are the default behavior, and dotted one-based array indexes are supported when configured through SerdePropertiesConfiguration.

Since:
3.1.0
See Also:
  • Constructor Details

    • PropertiesTreeAdapter

      public PropertiesTreeAdapter(JsonStreamMapper jsonStreamMapper, DeserializationConfiguration deserializationConfiguration, SerdePropertiesConfiguration propertiesConfiguration)
      Creates a properties tree adapter.
      Parameters:
      jsonStreamMapper - The JSON mapper used to convert non-string property values
      deserializationConfiguration - The deserialization configuration
      propertiesConfiguration - The properties format configuration
  • Method Details

    • parse

      public io.micronaut.json.tree.JsonNode parse(InputStream stream) throws IOException
      Parses a Java .properties stream into a JSON tree.
      Parameters:
      stream - The properties input stream
      Returns:
      The parsed JSON tree
      Throws:
      IOException - If the properties stream cannot be read