本文整理了Java中java.lang.Byte.doubleValue()
方法的一些代码示例,展示了Byte.doubleValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Byte.doubleValue()
方法的具体详情如下:
包路径:java.lang.Byte
类名称:Byte
方法名:doubleValue
[英]Returns the value of this Byte as a double.
[中]以双精度形式返回此字节的值。
代码示例来源:origin: apache/incubator-pinot
@Override
public Double toDouble(Object value) {
return ((Byte) value).doubleValue();
}
},
代码示例来源:origin: jfinal/jfinal
public Double toDouble(Byte self) {
return self.doubleValue();
}
代码示例来源:origin: voldemort/voldemort
private Double coerceToDouble(Object o) {
if(o == null)
return null;
Class<?> c = o.getClass();
if(c == Double.class)
return (Double) o;
else if(c == Byte.class)
return ((Byte) o).doubleValue();
else if(c == Short.class)
return ((Short) o).doubleValue();
else if(c == Integer.class)
return ((Integer) o).doubleValue();
else if(c == Float.class)
return ((Float) o).doubleValue();
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
case Types.DOUBLE:
case Types.FLOAT:
return new PGDouble( new Double( val.doubleValue() ) );
case Types.NUMERIC:
case Types.DECIMAL:
代码示例来源:origin: influxdata/influxdb-java
/**
* Add a field to this point.
*
* @param field
* the field name
* @param value
* the value of this field
* @return the Builder instance.
*/
@SuppressWarnings("checkstyle:finalparameters")
@Deprecated
public Builder field(final String field, Object value) {
if (value instanceof Number) {
if (value instanceof Byte) {
value = ((Byte) value).doubleValue();
} else if (value instanceof Short) {
value = ((Short) value).doubleValue();
} else if (value instanceof Integer) {
value = ((Integer) value).doubleValue();
} else if (value instanceof Long) {
value = ((Long) value).doubleValue();
} else if (value instanceof BigInteger) {
value = ((BigInteger) value).doubleValue();
}
}
fields.put(field, value);
return this;
}
代码示例来源:origin: com.ning/metrics.serialization-thrift
@Override
public Double getDouble()
{
return value.doubleValue();
}
代码示例来源:origin: com.jfinal/jfinal
public Double toDouble(Byte self) {
return self.doubleValue();
}
代码示例来源:origin: com.jfinal/enjoy
public Double toDouble(Byte self) {
return self.doubleValue();
}
代码示例来源:origin: cpesch/RouteConverter
private Double asDouble(Byte aByte) {
return aByte != null ? aByte.doubleValue() : null;
}
代码示例来源:origin: Diorite/Diorite
/**
* Coverts given bytes array to array of doubles.
*
* @param array
* bytes array to convert.
*
* @return converted array of doubles.
*/
public static double[] toDoubleArray(Byte[] array)
{
double[] result = new double[array.length];
for (int i = 0; i < array.length; i++)
{
result[i] = array[i].doubleValue();
}
return result;
}
代码示例来源:origin: com.att.cdp/cdp-pal-common
/**
* @param value
* The Byte value to be converted
* @return The value expressed as a Double
*/
private static Double toDouble(Byte value) {
if (value == null) {
return null;
}
return Double.valueOf(value.doubleValue());
}
代码示例来源:origin: meyerjp3/psychometrics
/**
* Count frequency of responses in each score category.
*
* @param itemResponse
*/
public void increment(byte itemResponse){
for(int i=0;i<nCat;i++){
if(itemResponse==scoreCategories[i]){
Tij[i]++;
Tip++;
}
if(itemResponse>=scoreCategories[i]){
Sij[i]++;
}
}
Sip += Byte.valueOf(itemResponse).doubleValue();
}
代码示例来源:origin: com.qwazr/qwazr-binder
@Override
public void fromByte(Byte value, Object object) {
set(object, value.doubleValue());
}
代码示例来源:origin: com.ning/metrics.serialization-thrift
@Override
public Double getDouble()
{
return getByte().doubleValue();
}
代码示例来源:origin: mozafari/verdictdb
public static Double toDouble(Object obj) {
if (obj instanceof Double) return (Double) obj;
else if (obj instanceof Float) return ((Float) obj).doubleValue();
else if (obj instanceof BigDecimal) return ((BigDecimal) obj).doubleValue();
else if (obj instanceof Long) return ((Long) obj).doubleValue();
else if (obj instanceof Integer) return ((Integer) obj).doubleValue();
else if (obj instanceof Short) return ((Short) obj).doubleValue();
else if (obj instanceof Byte) return ((Byte) obj).doubleValue();
else {
return null;
}
}
代码示例来源:origin: apache/eagle
/**
* @param obj
* @return double value, otherwise Double.NaN
*/
public static double convertObjToDouble(Object obj) {
if (Long.class.equals(obj.getClass()) || long.class.equals(obj.getClass())) {
Long _value = (Long)obj;
return _value.doubleValue();
} else if (Integer.class.equals(obj.getClass()) || int.class.equals(obj.getClass())) {
Integer _value = (Integer)obj;
return _value.doubleValue();
} else if (Double.class.equals(obj.getClass()) || double.class.equals(obj.getClass())) {
return (Double)obj;
} else if (Float.class.equals(obj.getClass()) || float.class.equals(obj.getClass())) {
Float _value = (Float)obj;
return _value.doubleValue();
} else if (Short.class.equals(obj.getClass()) || short.class.equals(obj.getClass())) {
Float _value = (Float)obj;
return _value.doubleValue();
} else if (Byte.class.equals(obj.getClass()) || byte.class.equals(obj.getClass())) {
Byte _value = (Byte)obj;
return _value.doubleValue();
}
LOG.warn("Failed to convert object " + obj.toString() + " in type of " + obj.getClass()
+ " to double");
return Double.NaN;
}
代码示例来源:origin: com.googlecode.q-link/q-link-core
public static double toDouble(Object obj)
{
if (obj instanceof Integer) {
return ((Integer) obj).doubleValue();
}
if (obj instanceof Double) {
return ((Double) obj).doubleValue();
}
if (obj instanceof Long) {
return ((Long) obj).doubleValue();
}
if (obj instanceof Short) {
return ((Short) obj).doubleValue();
}
if (obj instanceof Byte) {
return ((Byte) obj).doubleValue();
}
if (obj instanceof Float) {
return ((Float) obj).doubleValue();
}
throw new IllegalArgumentException("can't cast to number " + obj);
}
代码示例来源:origin: org.ow2.jasmine/mbeancmd-core
/**
* If o is numeric, returns a double representing thhat number. If not, returns zero.
* @param o
* @return a double
*/
public static double toDouble(Object o) {
double ret = 0.0;
Class cl = o.getClass();
if (cl.equals(Integer.class)) {
ret = ((Integer) o).doubleValue();
} else if (cl.equals(Long.class)) {
ret = ((Long) o).doubleValue();
} else if (cl.equals(Short.class)) {
ret = ((Short) o).doubleValue();
} else if (cl.equals(Byte.class)) {
ret = ((Byte) o).doubleValue();
} else if (cl.equals(Short.class)) {
ret = ((Short) o).doubleValue();
} else if (cl.equals(Float.class)) {
ret = ((Float) o).doubleValue();
} else if (cl.equals(Double.class)) {
ret = ((Double) o).doubleValue();
}
return ret;
}
代码示例来源:origin: org.apache.plc4x/plc4j-protocol-driver-base
@Override
public Double getDouble(int index) {
if (!isValidDouble(index)) {
throw new PlcIncompatibleDatatypeException(Double.class, index);
}
return getValue(index).doubleValue();
}
内容来源于网络,如有侵权,请联系作者删除!