Class JavaPropsMapper

java.lang.Object
tools.jackson.databind.ObjectMapper
tools.jackson.dataformat.javaprop.JavaPropsMapper
All Implemented Interfaces:
Serializable, tools.jackson.core.TreeCodec<tools.jackson.databind.JsonNode>, tools.jackson.core.Versioned

public class JavaPropsMapper extends tools.jackson.databind.ObjectMapper
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Base implementation for "Vanilla" ObjectMapper, used with Java Properties backend.
    private static final class 
    Helper class to contain dynamically constructed "shared" instance of mapper, should one be needed via shared().
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final long
     

    Fields inherited from class tools.jackson.databind.ObjectMapper

    _deserializationConfig, _deserializationContexts, _injectableValues, _rootDeserializers, _savedBuilderState, _serializationConfig, _serializationContexts, _streamFactory, _typeFactory
  • Constructor Summary

    Constructors
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Properties
     
     
    builder(JavaPropsFactory streamFactory)
     
    <T> T
    readEnvVariablesAs(JavaPropsSchema schema, Class<T> valueType)
    Convenience method, functionally equivalent to:
    <T> T
    readEnvVariablesAs(JavaPropsSchema schema, tools.jackson.databind.JavaType valueType)
    Convenience method, functionally equivalent to:
    <T> T
    readMapAs(Map<String,String> map, Class<T> valueType)
    Convenience method, functionally equivalent to:
    <T> T
    readMapAs(Map<String,String> map, tools.jackson.databind.JavaType valueType)
    Convenience method, functionally equivalent to:
    <T> T
    readMapAs(Map<String,String> map, JavaPropsSchema schema, Class<T> valueType)
    Convenience method which uses given `Properties` as the source as if they had been read from an external source, processes them (splits paths etc), and then binds as given result value.
    <T> T
    readMapAs(Map<String,String> map, JavaPropsSchema schema, tools.jackson.databind.JavaType valueType)
    Convenience method which uses given `Properties` as the source as if they had been read from an external source, processes them (splits paths etc), and then binds as given result value.
    <T> T
    readPropertiesAs(Properties props, Class<T> valueType)
    Convenience method, functionally equivalent to:
    <T> T
    readPropertiesAs(Properties props, tools.jackson.databind.JavaType valueType)
    Convenience method, functionally equivalent to:
    <T> T
    readPropertiesAs(Properties props, JavaPropsSchema schema, Class<T> valueType)
    Convenience method which uses given `Properties` as the source as if they had been read from an external source, processes them (splits paths etc), and then binds as given result value.
    <T> T
    readPropertiesAs(Properties props, JavaPropsSchema schema, tools.jackson.databind.JavaType valueType)
    Convenience method which uses given `Properties` as the source as if they had been read from an external source, processes them (splits paths etc), and then binds as given result value.
    protected Object
     
    <T> T
    Convenience method, functionally equivalent to:
    <T> T
    readSystemPropertiesAs(JavaPropsSchema schema, tools.jackson.databind.JavaType valueType)
    Convenience method, functionally equivalent to:
     
    Accessor method for getting globally shared "default" JavaPropsMapper instance: one that has default configuration, no modules registered, no config overrides.
     
    tools.jackson.core.Version
     
    protected Object
     
    void
    writeValue(Map<?,?> target, Object value)
    Convenience method that "writes" given `value` as properties in given Map object.
    void
    writeValue(Map<?,?> target, Object value, JavaPropsSchema schema)
    Convenience method that "writes" given `value` as properties in given Map object.
    Convenience method that serializes given value but so that results are stored in a newly constructed Properties.
    Convenience method that serializes given value but so that results are stored in given Properties instance.
    Convenience method that serializes given value but so that results are stored in a newly constructed Properties.
    Convenience method that serializes given value but so that results are stored in given Properties instance.

    Methods inherited from class tools.jackson.databind.ObjectMapper

    _assertNotNull, _configAndWriteValue, _convert, _deserializationContext, _deserializationContext, _deserializationContext, _findRootDeserializer, _initForReading, _newReader, _newReader, _newWriter, _newWriter, _newWriter, _readMapAndClose, _readTreeAndClose, _readValue, _serializationContext, _serializationContext, _verifyNoTrailingTokens, _verifySchemaType, _writeCloseableValue, acceptJsonFormatVisitor, acceptJsonFormatVisitor, acceptJsonFormatVisitor, booleanNode, clearCaches, constructType, constructType, convertValue, convertValue, convertValue, createArrayNode, createGenerator, createGenerator, createGenerator, createGenerator, createGenerator, createGenerator, createNonBlockingByteArrayParser, createNonBlockingByteBufferParser, createObjectNode, createParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser, deserializationConfig, getInjectableValues, getNodeFactory, getTypeFactory, isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, missingNode, nullNode, reader, reader, reader, reader, reader, reader, reader, reader, reader, readerFor, readerFor, readerFor, readerForArrayOf, readerForListOf, readerForMapOf, readerForUpdating, readerWithView, readTree, readTree, readTree, readTree, readTree, readTree, readTree, readTree, readTree, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValues, readValues, readValues, registeredModules, serializationConfig, stringNode, treeAsTokens, treeToValue, treeToValue, treeToValue, treeToValue, treeToValue, treeToValue, updateValue, valueToTree, writer, writer, writer, writer, writer, writer, writer, writer, writer, writer, writerFor, writerFor, writerFor, writerWithDefaultPrettyPrinter, writerWithView, writeTree, writeValue, writeValue, writeValue, writeValue, writeValue, writeValue, writeValueAsBytes, writeValueAsString, writeValueIntoBuffer

    Methods inherited from class Object

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

  • Constructor Details

  • Method Details

    • builder

      public static JavaPropsMapper.Builder builder()
    • builder

      public static JavaPropsMapper.Builder builder(JavaPropsFactory streamFactory)
    • rebuild

      public JavaPropsMapper.Builder rebuild()
      Overrides:
      rebuild in class tools.jackson.databind.ObjectMapper
    • shared

      public static JavaPropsMapper shared()
      Accessor method for getting globally shared "default" JavaPropsMapper instance: one that has default configuration, no modules registered, no config overrides. Usable mostly when dealing "untyped" or Tree-style content reading and writing.
    • writeReplace

      protected Object writeReplace()
      Overrides:
      writeReplace in class tools.jackson.databind.ObjectMapper
    • readResolve

      protected Object readResolve()
      Overrides:
      readResolve in class tools.jackson.databind.ObjectMapper
    • version

      public tools.jackson.core.Version version()
      Specified by:
      version in interface tools.jackson.core.Versioned
      Overrides:
      version in class tools.jackson.databind.ObjectMapper
    • tokenStreamFactory

      public JavaPropsFactory tokenStreamFactory()
      Overrides:
      tokenStreamFactory in class tools.jackson.databind.ObjectMapper
    • readPropertiesAs

      public <T> T readPropertiesAs(Properties props, JavaPropsSchema schema, Class<T> valueType) throws IOException
      Convenience method which uses given `Properties` as the source as if they had been read from an external source, processes them (splits paths etc), and then binds as given result value.

      Note that this is NOT identical to calling ObjectMapper.convertValue(Object, Class); rather, it would be similar to writing `Properties` out into a File, then calling `readValue()` on this mapper to bind contents.

      Throws:
      IOException
    • readPropertiesAs

      public <T> T readPropertiesAs(Properties props, JavaPropsSchema schema, tools.jackson.databind.JavaType valueType) throws IOException
      Convenience method which uses given `Properties` as the source as if they had been read from an external source, processes them (splits paths etc), and then binds as given result value.

      Note that this is NOT identical to calling ObjectMapper.convertValue(Object, Class); rather, it would be similar to writing `Properties` out into a File, then calling `readValue()` on this mapper to bind contents.

      Throws:
      IOException
    • readPropertiesAs

      public <T> T readPropertiesAs(Properties props, Class<T> valueType) throws IOException
      Convenience method, functionally equivalent to:
         readPropertiesAs(props, JavaPropsSchema.emptySchema(), valueType);
      
      Throws:
      IOException
    • readPropertiesAs

      public <T> T readPropertiesAs(Properties props, tools.jackson.databind.JavaType valueType) throws IOException
      Convenience method, functionally equivalent to:
         readPropertiesAs(props, JavaPropsSchema.emptySchema(), valueType);
      
      Throws:
      IOException
    • readMapAs

      public <T> T readMapAs(Map<String,String> map, JavaPropsSchema schema, Class<T> valueType) throws IOException
      Convenience method which uses given `Properties` as the source as if they had been read from an external source, processes them (splits paths etc), and then binds as given result value.

      Note that this is NOT identical to calling ObjectMapper.convertValue(Object, Class); rather, it would be similar to writing `Properties` out into a File, then calling `readValue()` on this mapper to bind contents.

      Throws:
      IOException
    • readMapAs

      public <T> T readMapAs(Map<String,String> map, JavaPropsSchema schema, tools.jackson.databind.JavaType valueType) throws IOException
      Convenience method which uses given `Properties` as the source as if they had been read from an external source, processes them (splits paths etc), and then binds as given result value.

      Note that this is NOT identical to calling ObjectMapper.convertValue(Object, Class); rather, it would be similar to writing `Properties` out into a File, then calling `readValue()` on this mapper to bind contents.

      Throws:
      IOException
    • readMapAs

      public <T> T readMapAs(Map<String,String> map, Class<T> valueType) throws IOException
      Convenience method, functionally equivalent to:
         readPropertiesAs(props, JavaPropsSchema.emptySchema(), valueType);
      
      Throws:
      IOException
    • readMapAs

      public <T> T readMapAs(Map<String,String> map, tools.jackson.databind.JavaType valueType) throws IOException
      Convenience method, functionally equivalent to:
         readPropertiesAs(props, JavaPropsSchema.emptySchema(), valueType);
      
      Throws:
      IOException
    • readSystemPropertiesAs

      public <T> T readSystemPropertiesAs(JavaPropsSchema schema, Class<T> valueType) throws IOException
      Convenience method, functionally equivalent to:
         readPropertiesAs(System.getProperties(), schema, valueType);
      
      Throws:
      IOException
    • readSystemPropertiesAs

      public <T> T readSystemPropertiesAs(JavaPropsSchema schema, tools.jackson.databind.JavaType valueType) throws IOException
      Convenience method, functionally equivalent to:
         readPropertiesAs(System.getProperties(), schema, valueType);
      
      Throws:
      IOException
    • readEnvVariablesAs

      public <T> T readEnvVariablesAs(JavaPropsSchema schema, Class<T> valueType) throws IOException
      Convenience method, functionally equivalent to:
         readPropertiesAs(convertMapToProperties(System.getenv()), schema, valueType);
      
      Throws:
      IOException
    • readEnvVariablesAs

      public <T> T readEnvVariablesAs(JavaPropsSchema schema, tools.jackson.databind.JavaType valueType) throws IOException
      Convenience method, functionally equivalent to:
         readPropertiesAs(convertMapToProperties(System.getenv()), schema, valueType);
      
      Throws:
      IOException
    • _env

      protected Properties _env()
    • writeValue

      public void writeValue(Map<?,?> target, Object value) throws IOException
      Convenience method that "writes" given `value` as properties in given Map object.
      Throws:
      IOException
    • writeValue

      public void writeValue(Map<?,?> target, Object value, JavaPropsSchema schema) throws IOException
      Convenience method that "writes" given `value` as properties in given Map object.
      Throws:
      IOException
    • writeValueAsProperties

      public Properties writeValueAsProperties(Object value) throws IOException
      Convenience method that serializes given value but so that results are stored in a newly constructed Properties. Functionally equivalent to serializing in a File and reading contents into Properties.
      Throws:
      IOException
    • writeValueAsProperties

      public Properties writeValueAsProperties(Object value, JavaPropsSchema schema) throws IOException
      Convenience method that serializes given value but so that results are stored in given Properties instance.
      Throws:
      IOException
    • writeValueAsMap

      public Map<String,String> writeValueAsMap(Object value) throws IOException
      Convenience method that serializes given value but so that results are stored in a newly constructed Properties. Functionally equivalent to serializing in a File and reading contents into Properties.
      Throws:
      IOException
    • writeValueAsMap

      public Map<String,String> writeValueAsMap(Object value, JavaPropsSchema schema) throws IOException
      Convenience method that serializes given value but so that results are stored in given Properties instance.
      Throws:
      IOException