public Integer toInt(Byte self) { return self.intValue(); }
@Override public Integer toInteger(Object value) { return ((Byte) value).intValue(); }
Byte b = rno[0]; // Boxing conversion converts `byte` to `Byte` int i = b.intValue();
public void set(String key, Byte value) { if (value != null) { attributes.put(key, value.intValue()); } }
@Override public void toJson(JsonWriter writer, Byte value) throws IOException { writer.value(value.intValue() & 0xff); }
public static BuilderInstruction buildConstant(Byte value, int register) { return buildConstant(value.intValue(), register); }
private Integer coerceToInteger(Object o) { if(o == null) return null; Class<?> c = o.getClass(); if(c == Integer.class) return (Integer) o; else if(c == Byte.class) return ((Byte) o).intValue(); else if(c == Short.class) return ((Short) o).intValue(); else throw new SerializationException("Object of type " + c.getName() + " cannot be coerced to type " + JsonTypes.INT32 + " as the schema specifies."); }
/** * Alternate factory method that will handle wrapper value, which may * be null. * Due to possibility of null, returning type is not guaranteed to be * {@link NumericNode}, but just {@link ValueNode}. */ @Override public ValueNode numberNode(Byte value) { return (value == null) ? nullNode() : IntNode.valueOf(value.intValue()); }
/** * Alternate factory method that will handle wrapper value, which may * be null. * Due to possibility of null, returning type is not guaranteed to be * {@link NumericNode}, but just {@link ValueNode}. */ @Override public ValueNode numberNode(Byte value) { return (value == null) ? nullNode() : IntNode.valueOf(value.intValue()); }
protected void printAnnotationArrayValue(final Object value) { if (value instanceof String[]) { print(((String[]) value)[1]); } else if (value instanceof AnnotationNode) { printAnnotation((AnnotationNode) value, 0, -1); } else if (value instanceof String) { print(value); } else if (value instanceof Byte) { pw.print(((Byte) value).intValue()); } else if (value instanceof Boolean) { pw.print(((Boolean) value).booleanValue() ? 1 : 0); } else if (value instanceof Character) { pw.print(new Integer(((Character) value).charValue())); } else if (value instanceof Short) { pw.print(((Short) value).intValue()); } else if (value instanceof Type) { pw.print(((Type) value).getDescriptor()); } else { print(value); } }
@Override public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException { IntegerType.INSTANCE.nullSafeSet( preparedStatement, (value == null ? null : ( (RevisionType) value ).getRepresentation().intValue()), index, session ); }
/** * Alternate factory method that will handle wrapper value, which may * be null. * Due to possibility of null, returning type is not guaranteed to be * {@link NumericNode}, but just {@link ValueNode}. * * @since 1.9 */ public ValueNode numberNode(Byte value) { return (value == null) ? nullNode() : IntNode.valueOf(value.intValue()); }
public Object getValFromData(ESMapping mapping, Map<String, Object> dmlData, String fieldName, String columnName) { String esType = getEsType(mapping, fieldName); Object value = dmlData.get(columnName); if (value instanceof Byte) { if ("boolean".equals(esType)) { value = ((Byte) value).intValue() != 0; } } // 如果是对象类型 if (mapping.getObjFields().containsKey(fieldName)) { return ESSyncUtil.convertToEsObj(value, mapping.getObjFields().get(fieldName)); } else { return ESSyncUtil.typeConvert(value, esType); } }
public Integer getIntProperty(final SimpleString key) throws ActiveMQPropertyConversionException { Object value = doGetProperty(key); if (value == null) { return Integer.valueOf(null); } else if (value instanceof Integer) { return (Integer) value; } else if (value instanceof Byte) { return ((Byte) value).intValue(); } else if (value instanceof Short) { return ((Short) value).intValue(); } else if (value instanceof SimpleString) { return Integer.parseInt(((SimpleString) value).toString()); } throw new ActiveMQPropertyConversionException("Invalid conversion: " + key); }
/** * Alternate factory method that will handle wrapper value, which may * be null. * Due to possibility of null, returning type is not guaranteed to be * {@link NumericNode}, but just {@link ValueNode}. */ @Override public ValueNode numberNode(Byte value) { return (value == null) ? nullNode() : IntNode.valueOf(value.intValue()); }
@Override public Object convert(Object input) { if (input == null) { return null; } Object inputFieldValue = inputOI.getField(input); byte inputFieldTag = inputOI.getTag(input); Object outputFieldValue = null; int inputFieldTagIndex = ((Byte)inputFieldTag).intValue(); if (inputFieldTagIndex >= 0 && inputFieldTagIndex < fieldConverters.size()) { outputFieldValue = fieldConverters.get(inputFieldTagIndex).convert(inputFieldValue); } outputOI.setFieldAndTag(output, outputFieldValue, inputFieldTag); return output; } }
public StringOrder toObject(byte[] bytes) { return new StringOrder(Byte.valueOf(bytes[0]).intValue()); } }
@Test public void parseNumberAsHex() { String aByte = "0x" + Integer.toHexString(Byte.valueOf(Byte.MAX_VALUE).intValue()); String aShort = "0x" + Integer.toHexString(Short.valueOf(Short.MAX_VALUE).intValue()); String anInteger = "0x" + Integer.toHexString(Integer.MAX_VALUE); String aLong = "0x" + Long.toHexString(Long.MAX_VALUE); String aReallyBigInt = "FEBD4E677898DFEBFFEE44"; assertByteEquals(aByte); assertShortEquals(aShort); assertIntegerEquals(anInteger); assertLongEquals(aLong); assertEquals("BigInteger did not parse", new BigInteger(aReallyBigInt, 16), NumberUtils.parseNumber("0x" + aReallyBigInt, BigInteger.class)); }
return addConstantInteger(((Integer) value).intValue()); } else if (value instanceof Byte) { return addConstantInteger(((Byte) value).intValue()); } else if (value instanceof Character) { return addConstantInteger(((Character) value).charValue());
/** * @throws IgniteCheckedException if failed. */ @Test public void testBadHashObjectKey() throws IgniteCheckedException { IgniteCache<BadHashKeyObject, Byte> cache = jcache(BadHashKeyObject.class, Byte.class); cache.put(new BadHashKeyObject("test_key1"), (byte)1); cache.put(new BadHashKeyObject("test_key0"), (byte)10); cache.put(new BadHashKeyObject("test_key1"), (byte)7); assertEquals(10, cache.query(new SqlQuery<BadHashKeyObject, Byte>(Byte.class, "_key = ?"). setArgs(new BadHashKeyObject("test_key0"))).getAll().get(0).getValue().intValue()); }