public Short toShort(Float self) { return self.shortValue(); }
return (X) Short.valueOf( value.shortValue() );
case Types.SMALLINT: case Types.TINYINT: return new PGShort(new Short( val.shortValue() )); case Types.VARCHAR: case Types.LONGVARCHAR:
assertFunction("sign(SMALLINT '" + intValue + "')", SMALLINT, signum.shortValue());
@Override public short shortValue( Float value ) { return value.shortValue(); }
@Override public short shortValue( Float value ) { return value.shortValue(); }
@Override public short shortValue( Float value ) { return value.shortValue(); }
public Short toShort(Float self) { return self.shortValue(); }
public short shortValue( Float value ) { return value.shortValue(); }
public Short toShort(Float self) { return self.shortValue(); }
@Override public Short convertTo(Float source, Type<Short> destinationType, MappingContext context) { if (!truncate && (source.compareTo((float) Short.MAX_VALUE) > 0 || source.compareTo((float) Short.MIN_VALUE) < 0)) { throw new ArithmeticException("Overflow: " + source + " cannot be represented by " + Short.class.getCanonicalName()); } return source.shortValue(); }
@Override public Short convertTo(Float source, Type<Short> destinationType) { if (!truncate && (source.compareTo((float) Short.MAX_VALUE) > 0 || source.compareTo((float) Short.MIN_VALUE) < 0)) { throw new ArithmeticException("Overflow: " + source + " cannot be represented by " + Short.class.getCanonicalName()); } return source.shortValue(); }
public Short convert(Object o) { if (((Float) o) > Short.MAX_VALUE) { throw new ConversionException("cannot coerce Float to Short since the value (" + valueOf(o) + ") exceeds that maximum precision of Integer."); } else { return ((Float) o).shortValue(); } } }
public Short convert(Object o) { if (((Float) o) > Short.MAX_VALUE) { throw new ConversionException("cannot coerce Float to Short since the value (" + valueOf(o) + ") exceeds that maximum precision of Integer."); } else { return ((Float) o).shortValue(); } } }
public Short convert(Object o) { if (((Float) o) > Short.MAX_VALUE) { throw new ConversionException("cannot coerce Float to Short since the value (" + valueOf(o) + ") exceeds that maximum precision of Integer."); } else { return ((Float) o).shortValue(); } } }
@Override public void fromFloat(Float value, Object object) { setShort(object, value.shortValue()); }
@Override public void fromFloat(Float value, Object object) { set(object, value.shortValue()); }
@AtlasConversionInfo(sourceType = FieldType.FLOAT, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Float value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN_VALUE) { throw new AtlasConversionException( String.format("Float %s is greater than Short.MAX_VALUE or is less than Short.MIN_VALUE", value)); } return value.shortValue(); }
public static Short toShort(Object obj) { if (obj instanceof Double) return ((Double) obj).shortValue(); else if (obj instanceof Float) return ((Float) obj).shortValue(); else if (obj instanceof BigDecimal) return ((BigDecimal) obj).toBigInteger().shortValue(); else if (obj instanceof Long) return ((Long) obj).shortValue(); else if (obj instanceof Integer) return ((Integer) obj).shortValue(); else if (obj instanceof Short) return ((Short) obj); else if (obj instanceof Byte) return ((Byte) obj).shortValue(); else if (obj instanceof Boolean) return ((Boolean) obj) ? (short) 1 : (short) 0; else { return null; // throw new VerdictDBTypeException(obj); } }
@Override public Short getShort(int index) { if (!isValidShort(index)) { throw new PlcIncompatibleDatatypeException(Short.class, index); } return getValue(index).shortValue(); }