本文整理了Java中java.lang.Byte.shortValue()
方法的一些代码示例,展示了Byte.shortValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Byte.shortValue()
方法的具体详情如下:
包路径:java.lang.Byte
类名称:Byte
方法名:shortValue
[英]Returns the value of this Byte as a short.
[中]以短字符形式返回此字节的值。
代码示例来源:origin: jfinal/jfinal
public Short toShort(Byte self) {
return self.shortValue();
}
代码示例来源:origin: voldemort/voldemort
private Short coerceToShort(Object o) {
if(o == null)
return null;
Class<?> c = o.getClass();
if(c == Short.class)
return (Short) o;
else if(c == Byte.class)
return ((Byte) o).shortValue();
else
throw new SerializationException("Object of type " + c.getName()
+ " cannot be coerced to type " + JsonTypes.INT16
+ " as the schema specifies.");
}
代码示例来源:origin: wildfly/wildfly
public static JsonArrayBuilder toJsonArrayBuilder(byte[] byteArray) {
JsonArrayBuilder jsonArrayBuilder = JsonLoader.createArrayBuilder();
if (byteArray != null) {
for (int i = 0; i < byteArray.length; i++) {
jsonArrayBuilder.add(((Byte) byteArray[i]).shortValue());
}
}
return jsonArrayBuilder;
}
代码示例来源:origin: wildfly/wildfly
public Short getShortProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
Object value = doGetProperty(key);
if (value == null) {
return Short.valueOf(null);
} else if (value instanceof Byte) {
return ((Byte) value).shortValue();
} else if (value instanceof Short) {
return (Short) value;
} else if (value instanceof SimpleString) {
return Short.parseShort(((SimpleString) value).toString());
}
throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
}
代码示例来源: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: wildfly/wildfly
public static void addToObject(final String key, final Object param, final JsonObjectBuilder jsonObjectBuilder) {
if (param instanceof Integer) {
jsonObjectBuilder.add(key, (Integer) param);
} else if (param instanceof Long) {
jsonObjectBuilder.add(key, (Long) param);
} else if (param instanceof Double) {
jsonObjectBuilder.add(key, (Double) param);
} else if (param instanceof String) {
jsonObjectBuilder.add(key, (String) param);
} else if (param instanceof Boolean) {
jsonObjectBuilder.add(key, (Boolean) param);
} else if (param instanceof Map) {
JsonObject mapObject = toJsonObject((Map<String, Object>) param);
jsonObjectBuilder.add(key, mapObject);
} else if (param instanceof Short) {
jsonObjectBuilder.add(key, (Short) param);
} else if (param instanceof Byte) {
jsonObjectBuilder.add(key, ((Byte) param).shortValue());
} else if (param instanceof SimpleString) {
jsonObjectBuilder.add(key, param.toString());
} else if (param == null) {
jsonObjectBuilder.addNull(key);
} else if (param instanceof byte[]) {
JsonArrayBuilder byteArrayObject = toJsonArrayBuilder((byte[]) param);
jsonObjectBuilder.add(key, byteArrayObject);
} else {
throw ActiveMQClientMessageBundle.BUNDLE.invalidManagementParam(param.getClass().getName());
}
}
代码示例来源:origin: apache/activemq
return ((Byte)value).shortValue();
代码示例来源:origin: wildfly/wildfly
public static void addToArray(final Object param, final JsonArrayBuilder jsonArrayBuilder) {
if (param instanceof Integer) {
jsonArrayBuilder.add((Integer) param);
} else if (param instanceof Long) {
jsonArrayBuilder.add((Long) param);
} else if (param instanceof Double) {
jsonArrayBuilder.add((Double) param);
} else if (param instanceof String) {
jsonArrayBuilder.add((String) param);
} else if (param instanceof Boolean) {
jsonArrayBuilder.add((Boolean) param);
} else if (param instanceof Map) {
JsonObject mapObject = toJsonObject((Map<String, Object>) param);
jsonArrayBuilder.add(mapObject);
} else if (param instanceof Short) {
jsonArrayBuilder.add((Short) param);
} else if (param instanceof Byte) {
jsonArrayBuilder.add(((Byte) param).shortValue());
} else if (param == null) {
jsonArrayBuilder.addNull();
} else if (param instanceof byte[]) {
JsonArrayBuilder byteArrayObject = toJsonArrayBuilder((byte[]) param);
jsonArrayBuilder.add(byteArrayObject);
} else {
throw ActiveMQClientMessageBundle.BUNDLE.invalidManagementParam(param.getClass().getName());
}
}
代码示例来源:origin: com.ning/metrics.serialization-thrift
@Override
public Short getShort()
{
return value.shortValue();
}
代码示例来源:origin: org.codehaus.castor/castor-jdo
/**
* {@inheritDoc}
*/
public Object convert(final Object object) {
return new Short(((Byte) object).shortValue());
}
代码示例来源:origin: org.teiid.connectors/translator-jdbc
@Override
public void bindValue(PreparedStatement stmt, Object param,
Class<?> paramType, int i) throws SQLException {
if (paramType == TypeFacility.RUNTIME_TYPES.BYTE) {
paramType = TypeFacility.RUNTIME_TYPES.SHORT;
param = ((Byte)param).shortValue();
}
super.bindValue(stmt, param, paramType, i);
}
代码示例来源:origin: org.eclipse.dirigible/dirigible-database-persistence
private Object shortAdaptation(Object value, Field field) {
if (field.getType().equals(short.class) || field.getType().equals(Short.class)) {
if (value instanceof Long) {
value = ((Long) value).shortValue();
} else if (value instanceof Integer) {
value = ((Integer) value).shortValue();
} else if (value instanceof Byte) {
value = ((Byte) value).shortValue();
}
}
return value;
}
代码示例来源:origin: apache/activemq-artemis
public static JsonArrayBuilder toJsonArrayBuilder(byte[] byteArray) {
JsonArrayBuilder jsonArrayBuilder = JsonLoader.createArrayBuilder();
if (byteArray != null) {
for (int i = 0; i < byteArray.length; i++) {
jsonArrayBuilder.add(((Byte) byteArray[i]).shortValue());
}
}
return jsonArrayBuilder;
}
代码示例来源:origin: apache/activemq-artemis
public Short getShortProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
Object value = doGetProperty(key);
if (value == null) {
return Short.valueOf(null);
} else if (value instanceof Byte) {
return ((Byte) value).shortValue();
} else if (value instanceof Short) {
return (Short) value;
} else if (value instanceof SimpleString) {
return Short.parseShort(((SimpleString) value).toString());
}
throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
}
代码示例来源:origin: org.apache.activemq/artemis-jms-client-all
public static JsonArrayBuilder toJsonArrayBuilder(byte[] byteArray) {
JsonArrayBuilder jsonArrayBuilder = JsonLoader.createArrayBuilder();
if (byteArray != null) {
for (int i = 0; i < byteArray.length; i++) {
jsonArrayBuilder.add(((Byte) byteArray[i]).shortValue());
}
}
return jsonArrayBuilder;
}
代码示例来源:origin: apache/activemq-artemis
public static JsonArrayBuilder toJsonArrayBuilder(byte[] byteArray) {
JsonArrayBuilder jsonArrayBuilder = JsonLoader.createArrayBuilder();
if (byteArray != null) {
for (int i = 0; i < byteArray.length; i++) {
jsonArrayBuilder.add(((Byte) byteArray[i]).shortValue());
}
}
return jsonArrayBuilder;
}
代码示例来源:origin: apache/activemq-artemis
public static JsonArrayBuilder toJsonArrayBuilder(byte[] byteArray) {
JsonArrayBuilder jsonArrayBuilder = JsonLoader.createArrayBuilder();
if (byteArray != null) {
for (int i = 0; i < byteArray.length; i++) {
jsonArrayBuilder.add(((Byte) byteArray[i]).shortValue());
}
}
return jsonArrayBuilder;
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
public static JsonArrayBuilder toJsonArrayBuilder(byte[] byteArray) {
JsonArrayBuilder jsonArrayBuilder = JsonLoader.createArrayBuilder();
if (byteArray != null) {
for (int i = 0; i < byteArray.length; i++) {
jsonArrayBuilder.add(((Byte) byteArray[i]).shortValue());
}
}
return jsonArrayBuilder;
}
代码示例来源:origin: apache/activemq-artemis
public Short getShortProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
Object value = doGetProperty(key);
if (value == null) {
return Short.valueOf(null);
} else if (value instanceof Byte) {
return ((Byte) value).shortValue();
} else if (value instanceof Short) {
return (Short) value;
} else if (value instanceof SimpleString) {
return Short.parseShort(((SimpleString) value).toString());
}
throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
}
代码示例来源:origin: org.apache.activemq/artemis-core-client
public static JsonArrayBuilder toJsonArrayBuilder(byte[] byteArray) {
JsonArrayBuilder jsonArrayBuilder = JsonLoader.createArrayBuilder();
if (byteArray != null) {
for (int i = 0; i < byteArray.length; i++) {
jsonArrayBuilder.add(((Byte) byteArray[i]).shortValue());
}
}
return jsonArrayBuilder;
}
内容来源于网络,如有侵权,请联系作者删除!