本文整理了Java中java.lang.Float.shortValue()
方法的一些代码示例,展示了Float.shortValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Float.shortValue()
方法的具体详情如下:
包路径:java.lang.Float
类名称:Float
方法名:shortValue
[英]Returns the value of this Float as a short (by casting to a short).
[中]
代码示例来源:origin: jfinal/jfinal
public Short toShort(Float self) {
return self.shortValue();
}
代码示例来源:origin: hibernate/hibernate-orm
return (X) Short.valueOf( value.shortValue() );
代码示例来源:origin: postgresql/postgresql
case Types.SMALLINT:
case Types.TINYINT:
return new PGShort(new Short( val.shortValue() ));
case Types.VARCHAR:
case Types.LONGVARCHAR:
代码示例来源:origin: prestodb/presto
assertFunction("sign(SMALLINT '" + intValue + "')", SMALLINT, signum.shortValue());
代码示例来源:origin: org.fcrepo/modeshape-common
@Override
public short shortValue( Float value ) {
return value.shortValue();
}
代码示例来源:origin: org.modeshape/modeshape-common
@Override
public short shortValue( Float value ) {
return value.shortValue();
}
代码示例来源:origin: ModeShape/modeshape
@Override
public short shortValue( Float value ) {
return value.shortValue();
}
代码示例来源:origin: com.jfinal/jfinal
public Short toShort(Float self) {
return self.shortValue();
}
代码示例来源:origin: org.jboss.dna/dna-common
public short shortValue( Float value ) {
return value.shortValue();
}
代码示例来源:origin: com.jfinal/enjoy
public Short toShort(Float self) {
return self.shortValue();
}
代码示例来源:origin: ma.glasnost.orika/orika-core
@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();
}
代码示例来源:origin: elaatifi/orika
@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();
}
代码示例来源:origin: org.mvel/mvel2
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();
}
}
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
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();
}
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.mvel
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();
}
}
}
代码示例来源:origin: com.qwazr/qwazr-binder
@Override
public void fromFloat(Float value, Object object) {
setShort(object, value.shortValue());
}
代码示例来源:origin: com.qwazr/qwazr-binder
@Override
public void fromFloat(Float value, Object object) {
set(object, value.shortValue());
}
代码示例来源:origin: io.atlasmap/atlas-core
@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();
}
代码示例来源:origin: mozafari/verdictdb
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);
}
}
代码示例来源:origin: org.apache.plc4x/plc4j-protocol-driver-base
@Override
public Short getShort(int index) {
if (!isValidShort(index)) {
throw new PlcIncompatibleDatatypeException(Short.class, index);
}
return getValue(index).shortValue();
}
内容来源于网络,如有侵权,请联系作者删除!