Class ScalarTypeJsonNode

    • Constructor Summary

      Constructors 
      Constructor Description
      ScalarTypeJsonNode​(com.fasterxml.jackson.databind.ObjectMapper objectMapper, int jdbcType)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void bind​(DataBind dataBind, com.fasterxml.jackson.databind.JsonNode value)
      Convert (if necessary) and bind the value to the preparedStatement.
      com.fasterxml.jackson.databind.JsonNode convertFromMillis​(long dateTime)
      Convert the systemTimeMillis into the appropriate java object.
      String formatValue​(com.fasterxml.jackson.databind.JsonNode jsonNode)
      Convert the type into a string representation.
      DocPropertyType getDocType()
      Return the type this maps to for JSON document stores.
      boolean isDateTimeCapable()
      Return true if the type can accept long systemTimeMillis input.
      boolean isDirty​(Object value)
      Return true if the value should be considered dirty (and included in an update).
      boolean isMutable()
      Map is a mutable type.
      com.fasterxml.jackson.databind.JsonNode jsonRead​(com.fasterxml.jackson.core.JsonParser parser)
      Read the value from JsonParser.
      void jsonWrite​(com.fasterxml.jackson.core.JsonGenerator writer, com.fasterxml.jackson.databind.JsonNode value)
      Write the value to the JsonGenerator.
      com.fasterxml.jackson.databind.JsonNode parse​(Reader reader)  
      com.fasterxml.jackson.databind.JsonNode parse​(String value)
      Convert the string value to the appropriate java object.
      com.fasterxml.jackson.databind.JsonNode read​(DataReader dataReader)
      Read the value from the resultSet and convert if necessary to the logical bean property value.
      com.fasterxml.jackson.databind.JsonNode readData​(DataInput dataInput)
      Read the value from binary input.
      com.fasterxml.jackson.databind.JsonNode toBeanType​(Object value)
      Convert the value as necessary to the logical Bean type.
      Object toJdbcType​(Object value)
      Convert the value as necessary to the JDBC type.
      void writeData​(DataOutput dataOutput, com.fasterxml.jackson.databind.JsonNode value)
      Write the value to binary output.
    • Constructor Detail

      • ScalarTypeJsonNode

        public ScalarTypeJsonNode​(com.fasterxml.jackson.databind.ObjectMapper objectMapper,
                                  int jdbcType)
    • Method Detail

      • isMutable

        public boolean isMutable()
        Map is a mutable type. Use the isDirty() method to check for dirty state.
        Specified by:
        isMutable in interface ScalarType<com.fasterxml.jackson.databind.JsonNode>
        Overrides:
        isMutable in class ScalarTypeBase<com.fasterxml.jackson.databind.JsonNode>
      • isDirty

        public boolean isDirty​(Object value)
        Return true if the value should be considered dirty (and included in an update).
        Specified by:
        isDirty in interface ScalarType<com.fasterxml.jackson.databind.JsonNode>
        Overrides:
        isDirty in class ScalarTypeBase<com.fasterxml.jackson.databind.JsonNode>
      • read

        public com.fasterxml.jackson.databind.JsonNode read​(DataReader dataReader)
                                                     throws SQLException
        Description copied from interface: ScalarType
        Read the value from the resultSet and convert if necessary to the logical bean property value.
        Throws:
        SQLException
      • bind

        public void bind​(DataBind dataBind,
                         com.fasterxml.jackson.databind.JsonNode value)
                  throws SQLException
        Description copied from interface: ScalarType
        Convert (if necessary) and bind the value to the preparedStatement.

        value may need to be converted from the logical bean property type to the JDBC type.

        Throws:
        SQLException
      • toJdbcType

        public Object toJdbcType​(Object value)
        Description copied from interface: ScalarType
        Convert the value as necessary to the JDBC type.

        Note that this should also match the type as per the getJdbcType() method.

        This is typically used when the matching type is used in a where clause and we use this to ensure it is an appropriate jdbc type.

      • toBeanType

        public com.fasterxml.jackson.databind.JsonNode toBeanType​(Object value)
        Description copied from interface: ScalarType
        Convert the value as necessary to the logical Bean type.

        The type as per the bean property.

        This is used to automatically convert id values (typically from a string to a int, long or UUID).

      • formatValue

        public String formatValue​(com.fasterxml.jackson.databind.JsonNode jsonNode)
        Description copied from interface: ScalarType
        Convert the type into a string representation.

        Reciprocal of parse().

      • parse

        public com.fasterxml.jackson.databind.JsonNode parse​(String value)
        Description copied from interface: ScalarType
        Convert the string value to the appropriate java object.

        Mostly used to support CSV, JSON and XML parsing.

        Reciprocal of formatValue().

      • parse

        public com.fasterxml.jackson.databind.JsonNode parse​(Reader reader)
      • convertFromMillis

        public com.fasterxml.jackson.databind.JsonNode convertFromMillis​(long dateTime)
        Description copied from interface: ScalarType
        Convert the systemTimeMillis into the appropriate java object.

        For non dateTime types this will throw an exception.

      • isDateTimeCapable

        public boolean isDateTimeCapable()
        Description copied from interface: ScalarType
        Return true if the type can accept long systemTimeMillis input.

        This is used to determine if is is sensible to use the ScalarType.convertFromMillis(long) method.

        This includes the Date, Calendar, sql Date, Time, Timestamp, JODA types as well as Long, BigDecimal and String (although it generally is not expected to parse systemTimeMillis to a String or BigDecimal).

      • jsonWrite

        public void jsonWrite​(com.fasterxml.jackson.core.JsonGenerator writer,
                              com.fasterxml.jackson.databind.JsonNode value)
                       throws IOException
        Description copied from interface: ScalarType
        Write the value to the JsonGenerator.
        Throws:
        IOException
      • jsonRead

        public com.fasterxml.jackson.databind.JsonNode jsonRead​(com.fasterxml.jackson.core.JsonParser parser)
                                                         throws IOException
        Description copied from interface: ScalarType
        Read the value from JsonParser.
        Throws:
        IOException