/** {@inheritDoc} */ @Override public Value value(GridKernalContext ctx) { return ValueByte.get(x); }
/** * Get or create byte value for the given byte. * * @param i the byte * @return the value */ public static ValueByte get(byte i) { return (ValueByte) Value.cache(new ValueByte(i)); }
@Override public Value subtract(Value v) { ValueByte other = (ValueByte) v; return checkRange(value - other.value); }
public Value add(Value v) throws SQLException { ValueByte other = (ValueByte) v; if (SysProperties.OVERFLOW_EXCEPTIONS) { return checkRange(value + other.value); } return ValueByte.get((byte) (value + other.value)); }
public byte getByte() { return ((ValueByte) convertTo(Value.BYTE)).getByte(); }
@Override public String getSQL() { return getString(); }
public Value subtract(Value v) throws SQLException { ValueByte other = (ValueByte) v; if (SysProperties.OVERFLOW_EXCEPTIONS) { return checkRange(value - other.value); } return ValueByte.get((byte) (value - other.value)); }
public byte getByte() throws SQLException { return ((ValueByte) convertTo(Value.BYTE)).getByte(); }
@Override public String getSQL() { return getString(); }
private static ValueByte checkRange(int x) { if (x < Byte.MIN_VALUE || x > Byte.MAX_VALUE) { throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Integer.toString(x)); } return ValueByte.get((byte) x); }
public Value multiply(Value v) throws SQLException { ValueByte other = (ValueByte) v; if (SysProperties.OVERFLOW_EXCEPTIONS) { return checkRange(value * other.value); } return ValueByte.get((byte) (value * other.value)); }
@Override public Value add(Value v) { ValueByte other = (ValueByte) v; return checkRange(value + other.value); }
/** * Get or create byte value for the given byte. * * @param i the byte * @return the value */ public static ValueByte get(byte i) { return (ValueByte) Value.cache(new ValueByte(i)); }
public byte getByte() { return ((ValueByte) convertTo(Value.BYTE)).getByte(); }
@Override public String getSQL() { return getString(); }