本文整理了Java中java.lang.Byte.floatValue()
方法的一些代码示例,展示了Byte.floatValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Byte.floatValue()
方法的具体详情如下:
包路径:java.lang.Byte
类名称:Byte
方法名:floatValue
[英]Returns the value of this Byte as a float.
[中]以浮点形式返回此字节的值。
代码示例来源:origin: jfinal/jfinal
public Float toFloat(Byte self) {
return self.floatValue();
}
代码示例来源:origin: apache/incubator-pinot
@Override
public Float toFloat(Object value) {
return ((Byte) value).floatValue();
}
代码示例来源:origin: voldemort/voldemort
private Float coerceToFloat(Object o) {
if(o == null)
return null;
Class<?> c = o.getClass();
if(c == Float.class)
return (Float) o;
else if(c == Byte.class)
return ((Byte) o).floatValue();
else if(c == Short.class)
return ((Short) o).floatValue();
else if(c == Integer.class)
return ((Integer) o).floatValue();
else
throw new SerializationException("Object of type " + c.getName()
+ " cannot be coerced to type " + JsonTypes.FLOAT32
+ " as the schema specifies.");
}
代码示例来源:origin: hibernate/hibernate-orm
@SuppressWarnings({ "unchecked" })
@Override
public <X> X unwrap(Byte value, Class<X> type, WrapperOptions options) {
if ( value == null ) {
return null;
}
if ( Byte.class.isAssignableFrom( type ) ) {
return (X) value;
}
if ( Short.class.isAssignableFrom( type ) ) {
return (X) Short.valueOf( value.shortValue() );
}
if ( Integer.class.isAssignableFrom( type ) ) {
return (X) Integer.valueOf( value.intValue() );
}
if ( Long.class.isAssignableFrom( type ) ) {
return (X) Long.valueOf( value.longValue() );
}
if ( Double.class.isAssignableFrom( type ) ) {
return (X) Double.valueOf( value.doubleValue() );
}
if ( Float.class.isAssignableFrom( type ) ) {
return (X) Float.valueOf( value.floatValue() );
}
if ( String.class.isAssignableFrom( type ) ) {
return (X) value.toString();
}
throw unknownUnwrap( type );
}
@Override
代码示例来源:origin: postgresql/postgresql
return new PGByte( val );
case Types.REAL:
return new PGFloat( new Float( val.floatValue() ) );
case Types.DOUBLE:
case Types.FLOAT:
代码示例来源:origin: geotools/geotools
} else if (obj instanceof Byte) {
Byte i = (Byte) obj;
opacity = i.floatValue();
} else if (obj instanceof String) {
try {
代码示例来源:origin: com.jfinal/jfinal
public Float toFloat(Byte self) {
return self.floatValue();
}
代码示例来源:origin: com.jfinal/enjoy
public Float toFloat(Byte self) {
return self.floatValue();
}
代码示例来源:origin: Diorite/Diorite
/**
* Coverts given bytes array to array of floats.
*
* @param array
* bytes array to convert.
*
* @return converted array of floats.
*/
public static float[] toFloatArray(Byte[] array)
{
float[] result = new float[array.length];
for (int i = 0; i < array.length; i++)
{
result[i] = array[i].floatValue();
}
return result;
}
代码示例来源:origin: apache/ofbiz-framework
@Override
protected String format(Byte obj, NumberFormat nf) throws ConversionException {
return nf.format(obj.floatValue());
}
}
代码示例来源:origin: com.qwazr/qwazr-binder
@Override
public void fromByte(Byte value, Object object) {
setFloat(object, value.floatValue());
}
代码示例来源:origin: com.qwazr/qwazr-binder
@Override
public void fromByte(Byte value, Object object) {
set(object, value.floatValue());
}
代码示例来源:origin: com.graphaware.neo4j/common
private static float getFloat(String entity, String key, Object value) {
if (value instanceof Byte) {
return ((Byte) value).floatValue();
}
if (value instanceof Double) {
return ((Double) value).floatValue();
}
if (value instanceof Integer) {
return ((Integer) value).floatValue();
}
if (value instanceof Long) {
return ((Long) value).floatValue();
}
if (value instanceof Float) {
return (Float) value;
}
throw new ClassCastException(value + " is not a number! (" + entity + ", key=" + key + ")");
}
代码示例来源:origin: mozafari/verdictdb
public static Float toFloat(Object obj) {
if (obj instanceof Double) return ((Double) obj).floatValue();
else if (obj instanceof Float) return ((Float) obj);
else if (obj instanceof BigDecimal) return ((BigDecimal) obj).floatValue();
else if (obj instanceof Long) return ((Long) obj).floatValue();
else if (obj instanceof Integer) return ((Integer) obj).floatValue();
else if (obj instanceof Short) return ((Short) obj).floatValue();
else if (obj instanceof Byte) return ((Byte) obj).floatValue();
else {
return null;
}
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
@SuppressWarnings({ "unchecked" })
public <X> X unwrap(Byte value, Class<X> type, WrapperOptions options) {
if ( value == null ) {
return null;
}
if ( Byte.class.isAssignableFrom( type ) ) {
return (X) value;
}
if ( Short.class.isAssignableFrom( type ) ) {
return (X) Short.valueOf( value.shortValue() );
}
if ( Integer.class.isAssignableFrom( type ) ) {
return (X) Integer.valueOf( value.intValue() );
}
if ( Long.class.isAssignableFrom( type ) ) {
return (X) Long.valueOf( value.longValue() );
}
if ( Double.class.isAssignableFrom( type ) ) {
return (X) Double.valueOf( value.doubleValue() );
}
if ( Float.class.isAssignableFrom( type ) ) {
return (X) Float.valueOf( value.floatValue() );
}
if ( String.class.isAssignableFrom( type ) ) {
return (X) value.toString();
}
throw unknownUnwrap( type );
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
@SuppressWarnings({ "unchecked" })
public <X> X unwrap(Byte value, Class<X> type, WrapperOptions options) {
if ( value == null ) {
return null;
}
if ( Byte.class.isAssignableFrom( type ) ) {
return (X) value;
}
if ( Short.class.isAssignableFrom( type ) ) {
return (X) Short.valueOf( value.shortValue() );
}
if ( Integer.class.isAssignableFrom( type ) ) {
return (X) Integer.valueOf( value.intValue() );
}
if ( Long.class.isAssignableFrom( type ) ) {
return (X) Long.valueOf( value.longValue() );
}
if ( Double.class.isAssignableFrom( type ) ) {
return (X) Double.valueOf( value.doubleValue() );
}
if ( Float.class.isAssignableFrom( type ) ) {
return (X) Float.valueOf( value.floatValue() );
}
if ( String.class.isAssignableFrom( type ) ) {
return (X) value.toString();
}
throw unknownUnwrap( type );
}
代码示例来源:origin: org.hibernate.orm/hibernate-core
@SuppressWarnings({ "unchecked" })
@Override
public <X> X unwrap(Byte value, Class<X> type, SharedSessionContractImplementor session) {
if ( value == null ) {
return null;
}
if ( Byte.class.isAssignableFrom( type ) ) {
return (X) value;
}
if ( Short.class.isAssignableFrom( type ) ) {
return (X) Short.valueOf( value.shortValue() );
}
if ( Integer.class.isAssignableFrom( type ) ) {
return (X) Integer.valueOf( value.intValue() );
}
if ( Long.class.isAssignableFrom( type ) ) {
return (X) Long.valueOf( value.longValue() );
}
if ( Double.class.isAssignableFrom( type ) ) {
return (X) Double.valueOf( value.doubleValue() );
}
if ( Float.class.isAssignableFrom( type ) ) {
return (X) Float.valueOf( value.floatValue() );
}
if ( String.class.isAssignableFrom( type ) ) {
return (X) value.toString();
}
throw unknownUnwrap( type );
}
代码示例来源:origin: org.geotools/gt2-shapefile-renderer
private void checkOpacity(Expression exp) {
if (exp != null) {
if (exp instanceof Literal) {
Literal literal = (Literal) exp;
Object obj = literal.getValue();
float opacity;
if (obj instanceof Integer) {
Integer i = (Integer) obj;
opacity = i.floatValue();
} else if (obj instanceof Float) {
Float i = (Float) obj;
opacity = i.floatValue();
} else if (obj instanceof Double) {
Double i = (Double) obj;
opacity = i.floatValue();
} else if (obj instanceof Short) {
Short i = (Short) obj;
opacity = i.floatValue();
} else if (obj instanceof Byte) {
Byte i = (Byte) obj;
opacity = i.floatValue();
} else {
return;
}
if ((opacity > 0.01) && (opacity < 0.99)) {
this.hasOpacity = true;
}
}
}
}
代码示例来源:origin: org.apache.plc4x/plc4j-protocol-driver-base
@Override
public Float getFloat(int index) {
if (!isValidFloat(index)) {
throw new PlcIncompatibleDatatypeException(Float.class, index);
}
return getValue(index).floatValue();
}
代码示例来源:origin: org.ancoron.postgresql/org.postgresql.osgi
return new PGByte( val );
case Types.REAL:
return new PGFloat( new Float( val.floatValue() ) );
case Types.DOUBLE:
case Types.FLOAT:
内容来源于网络,如有侵权,请联系作者删除!