Class ScalarTypeWrapper<B,​S>

    • Method Detail

      • isBinaryType

        public boolean isBinaryType()
        Description copied from interface: ScalarType
        Return true if this is a binary type and can not support parse() and format() from/to string. This allows Ebean to optimise marshalling types to string.
        Specified by:
        isBinaryType in interface ScalarType<B>
      • isMutable

        public boolean isMutable()
        Description copied from interface: ScalarType
        Return true if this is a mutable scalar type (like hstore).
        Specified by:
        isMutable in interface ScalarType<B>
      • isDirty

        public boolean isDirty​(Object value)
        Description copied from interface: ScalarType
        For mutable scalarType's return true if the value is dirty. Non-dirty properties may be excluded from updates.
        Specified by:
        isDirty in interface ScalarType<B>
      • bind

        public void bind​(DataBind b,
                         B 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.

        Specified by:
        bind in interface ScalarType<B>
        Throws:
        SQLException
      • getJdbcType

        public int getJdbcType()
        Description copied from interface: ScalarType
        Return the type as per java.sql.Types that this maps to.

        This type should be consistent with the toJdbcType() method in converting the type to the appropriate type for binding to preparedStatements.

        Specified by:
        getJdbcType in interface ScalarType<B>
      • getLength

        public int getLength()
        Description copied from interface: ScalarType
        Return the default DB column length for this type.

        If a BeanProperty has no explicit length defined then this length should be assigned.

        This is primarily to support defining a length on Enum types (to supplement defining the length on the BeanProperty directly).

        Specified by:
        getLength in interface ScalarType<B>
      • getType

        public Class<BgetType()
        Description copied from interface: ScalarType
        Return the type that matches the bean property type.

        This represents the 'logical' type rather than the JDBC type this maps to.

        Specified by:
        getType in interface ScalarType<B>
      • 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).

        Specified by:
        isDateTimeCapable in interface ScalarType<B>
      • isJdbcNative

        public boolean isJdbcNative()
        Description copied from interface: ScalarType
        Return true if the type is native to JDBC.

        If it is native to JDBC then its values/instances do not need to be converted to and from an associated JDBC type.

        Specified by:
        isJdbcNative in interface ScalarType<B>
      • format

        public String format​(Object v)
        Description copied from interface: ScalarType
        Convert the type into a string representation.

        This assumes the value is of the correct type.

        This is so that ScalarType also implements the StringFormatter interface.

        Specified by:
        format in interface ScalarType<B>
        Specified by:
        format in interface StringFormatter
      • parse

        public B 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().

        Specified by:
        parse in interface ScalarType<B>
        Specified by:
        parse in interface StringParser
      • convertFromMillis

        public B convertFromMillis​(long systemTimeMillis)
        Description copied from interface: ScalarType
        Convert the systemTimeMillis into the appropriate java object.

        For non dateTime types this will throw an exception.

        Specified by:
        convertFromMillis in interface ScalarType<B>
      • loadIgnore

        public void loadIgnore​(DataReader dataReader)
        Description copied from interface: ScalarType
        Ignore the reading of this value. Typically this means moving the index position in the ResultSet.
        Specified by:
        loadIgnore in interface ScalarType<B>
      • toBeanType

        public B 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).

        Specified by:
        toBeanType in interface ScalarType<B>
      • 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.

        Specified by:
        toJdbcType in interface ScalarType<B>