Class ScalarTypeWrapper<B,S>

java.lang.Object
io.ebeaninternal.server.type.ScalarTypeWrapper<B,S>
Type Parameters:
B - the logical type
S - the underlying scalar type this is converted to
All Implemented Interfaces:
io.ebean.core.type.ScalarDataReader<B>, io.ebean.core.type.ScalarType<B>, io.ebean.text.StringFormatter, io.ebean.text.StringParser

public class ScalarTypeWrapper<B,S> extends Object implements io.ebean.core.type.ScalarType<B>
A ScalarType that uses a ScalarTypeConverter to convert to and from another underlying ScalarType.

Enables the use of a simple interface to add additional scalarTypes.

  • Constructor Details

    • ScalarTypeWrapper

      public ScalarTypeWrapper(Class<B> wrapperType, io.ebean.core.type.ScalarType<S> scalarType, io.ebean.config.ScalarTypeConverter<B,S> converter)
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • asVersion

      public long asVersion(B value)
      Specified by:
      asVersion in interface io.ebean.core.type.ScalarType<B>
    • binary

      public boolean binary()
      Specified by:
      binary in interface io.ebean.core.type.ScalarType<B>
    • mutable

      public boolean mutable()
      Specified by:
      mutable in interface io.ebean.core.type.ScalarType<B>
    • isDirty

      public boolean isDirty(Object value)
      Specified by:
      isDirty in interface io.ebean.core.type.ScalarType<B>
    • readData

      public B readData(DataInput dataInput) throws IOException
      Specified by:
      readData in interface io.ebean.core.type.ScalarType<B>
      Throws:
      IOException
    • writeData

      public void writeData(DataOutput dataOutput, B value) throws IOException
      Specified by:
      writeData in interface io.ebean.core.type.ScalarType<B>
      Throws:
      IOException
    • bind

      public void bind(io.ebean.core.type.DataBinder binder, B value) throws SQLException
      Specified by:
      bind in interface io.ebean.core.type.ScalarType<B>
      Throws:
      SQLException
    • jdbcType

      public int jdbcType()
      Specified by:
      jdbcType in interface io.ebean.core.type.ScalarType<B>
    • length

      public int length()
      Specified by:
      length in interface io.ebean.core.type.ScalarType<B>
    • type

      public Class<B> type()
      Specified by:
      type in interface io.ebean.core.type.ScalarType<B>
    • jdbcNative

      public boolean jdbcNative()
      Specified by:
      jdbcNative in interface io.ebean.core.type.ScalarType<B>
    • formatValue

      public String formatValue(B v)
      Specified by:
      formatValue in interface io.ebean.core.type.ScalarType<B>
    • parse

      public B parse(String value)
      Specified by:
      parse in interface io.ebean.core.type.ScalarType<B>
      Specified by:
      parse in interface io.ebean.text.StringParser
    • read

      public B read(io.ebean.core.type.DataReader reader) throws SQLException
      Specified by:
      read in interface io.ebean.core.type.ScalarDataReader<B>
      Specified by:
      read in interface io.ebean.core.type.ScalarType<B>
      Throws:
      SQLException
    • toBeanType

      public B toBeanType(Object value)
      Specified by:
      toBeanType in interface io.ebean.core.type.ScalarType<B>
    • toJdbcType

      public Object toJdbcType(Object value)
      Specified by:
      toJdbcType in interface io.ebean.core.type.ScalarType<B>
    • getScalarType

      public io.ebean.core.type.ScalarType<?> getScalarType()
    • jsonRead

      public B jsonRead(com.fasterxml.jackson.core.JsonParser parser) throws IOException
      Specified by:
      jsonRead in interface io.ebean.core.type.ScalarType<B>
      Throws:
      IOException
    • jsonWrite

      public void jsonWrite(com.fasterxml.jackson.core.JsonGenerator writer, B beanValue) throws IOException
      Specified by:
      jsonWrite in interface io.ebean.core.type.ScalarType<B>
      Throws:
      IOException
    • docType

      public io.ebean.core.type.DocPropertyType docType()
      Specified by:
      docType in interface io.ebean.core.type.ScalarType<B>