本文整理了Java中java.lang.Byte.longValue()
方法的一些代码示例,展示了Byte.longValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Byte.longValue()
方法的具体详情如下:
包路径:java.lang.Byte
类名称:Byte
方法名:longValue
[英]Returns the value of this Byte as a long.
[中]将此字节的值返回为long。
代码示例来源:origin: jfinal/jfinal
public Long toLong(Byte self) {
return self.longValue();
}
代码示例来源:origin: apache/incubator-pinot
@Override
public Long toLong(Object value) {
return ((Byte) value).longValue();
}
代码示例来源:origin: voldemort/voldemort
private Long coerceToLong(Object o) {
if(o == null)
return null;
Class<?> c = o.getClass();
if(c == Long.class)
return (Long) o;
else if(c == Byte.class)
return ((Byte) o).longValue();
else if(c == Short.class)
return ((Short) o).longValue();
else if(c == Integer.class)
return ((Integer) o).longValue();
else
throw new SerializationException("Object of type " + c.getName()
+ " cannot be coerced to type " + JsonTypes.INT64
+ " 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: prestodb/presto
return (T) (Long) ((Byte) Byte.parseByte(strValue)).longValue();
代码示例来源:origin: prestodb/presto
toEncode = ((Byte) value).longValue();
代码示例来源:origin: wildfly/wildfly
public Long getLongProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
Object value = doGetProperty(key);
if (value == null) {
return Long.valueOf(null);
} else if (value instanceof Long) {
return (Long) value;
} else if (value instanceof Byte) {
return ((Byte) value).longValue();
} else if (value instanceof Short) {
return ((Short) value).longValue();
} else if (value instanceof Integer) {
return ((Integer) value).longValue();
} else if (value instanceof SimpleString) {
return Long.parseLong(((SimpleString) value).toString());
}
throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
}
代码示例来源:origin: pentaho/pentaho-kettle
return new BigDecimal( ( (Byte) value ).longValue() );
} else if ( classType.equalsIgnoreCase( "java.lang.Short" ) ) {
return new BigDecimal( ( (Short) value ).longValue() );
代码示例来源:origin: apache/activemq
return ((Byte)value).longValue();
代码示例来源:origin: networknt/light-4j
private String format(Object o) {
if (o instanceof Float) {
return format(((Float) o).doubleValue());
} else if (o instanceof Double) {
return format(((Double) o).doubleValue());
} else if (o instanceof Byte) {
return format(((Byte) o).longValue());
} else if (o instanceof Short) {
return format(((Short) o).longValue());
} else if (o instanceof Integer) {
return format(((Integer) o).longValue());
} else if (o instanceof Long) {
return format(((Long) o).longValue());
}
return null;
}
private String format(long n) {
代码示例来源:origin: robovm/robovm
value = ((Short) arg).longValue();
} else if (arg instanceof Byte) {
value = ((Byte) arg).longValue();
} else {
throw badArgumentType();
代码示例来源:origin: pentaho/pentaho-kettle
} else if ( valueData instanceof Byte ) {
valueType = ValueMetaInterface.TYPE_INTEGER;
valueData = Long.valueOf( ( (Byte) valueData ).longValue() );
} else if ( valueData instanceof Long ) {
valueType = ValueMetaInterface.TYPE_INTEGER;
代码示例来源:origin: pentaho/pentaho-kettle
} else if ( valueData instanceof Byte ) {
valueMeta = new ValueMetaInteger( valueName );
valueData = Long.valueOf( ( (Byte) valueData ).longValue() );
} else if ( valueData instanceof Long ) {
valueMeta = new ValueMetaInteger( valueName );
代码示例来源:origin: prestodb/presto
case 8:
assertTrue(obj instanceof Byte);
assertEquals(((Byte) obj).longValue(), casted);
break;
default:
代码示例来源:origin: speedment/speedment
printLong(((Short) unknown).longValue());
} else if (type == Byte.class) {
printLong(((Byte) unknown).longValue());
} else if (type == Boolean.class) {
printBoolean((Boolean) unknown);
代码示例来源:origin: pentaho/pentaho-kettle
case ValueMetaInterface.TYPE_INTEGER:
if ( classname.equalsIgnoreCase( "java.lang.Byte" ) ) {
res.setValue( ( (java.lang.Byte) result ).longValue() );
} else if ( classname.equalsIgnoreCase( "java.lang.Short" ) ) {
res.setValue( ( (Short) result ).longValue() );
代码示例来源:origin: pentaho/pentaho-kettle
case ValueMetaInterface.TYPE_INTEGER:
if ( classname.equalsIgnoreCase( "java.lang.Byte" ) ) {
res.setValue( ( (java.lang.Byte) result ).longValue() );
} else if ( classname.equalsIgnoreCase( "java.lang.Short" ) ) {
res.setValue( ( (Short) result ).longValue() );
代码示例来源:origin: hector-client/hector
@Override
public byte[] convertObjTypeToCassType(Object value) {
BigInteger bigInt;
if (value instanceof Byte) {
bigInt = BigInteger.valueOf(((Byte) value).longValue());
} else if (value instanceof Short) {
bigInt = BigInteger.valueOf(((Short) value).longValue());
} else if (value instanceof Integer) {
bigInt = BigInteger.valueOf(((Integer) value).longValue());
} else if (value instanceof Long) {
bigInt = BigInteger.valueOf((Long) value);
} else if (value instanceof BigInteger) {
bigInt = (BigInteger) value;
} else {
throw new HectorObjectMapperException(
"value of type "
+ value.getClass().getName()
+ " is not an integer type (in a mathematical context) and cannot be converted to a variable integer type");
}
return BigIntegerSerializer.get().toBytes(bigInt);
}
}
代码示例来源:origin: jpox/jpox
public ScalarExpression newLiteral(QueryExpression qs, Object value)
{
ScalarExpression expr = new ByteLiteral(qs, this, BigInteger.valueOf(((Byte)value).longValue()));
return expr;
}
代码示例来源:origin: org.apache.plc4x/plc4j-protocol-driver-base
@Override
public Long getLong(int index) {
if (!isValidLong(index)) {
throw new PlcIncompatibleDatatypeException(Long.class, index);
}
return getValue(index).longValue();
}
内容来源于网络,如有侵权,请联系作者删除!