@Override public Long toLong(Object value) { return ((Short) value).longValue(); }
public Long toLong(Short self) { return self.longValue(); }
public static Number add(Short first, int second) { long sum = first.longValue() + second; if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return Short.valueOf((short) sum); if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return Integer.valueOf((int) sum); return Long.valueOf(sum); }
public static Number add(Short first, long second) { long sum = first.longValue() + second; if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return Short.valueOf((short) sum); if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return Integer.valueOf((int) sum); return Long.valueOf(sum); }
public static Number add(Short first, BigInteger second) { return second.add(BigInteger.valueOf(first.longValue())); }
public static Number add(Short first, BigDecimal second) { return second.add(BigDecimal.valueOf(first.longValue())); }
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."); }
/** * Get the result of an Object path expression as a long. * * @param path The Object path. * @return The object matching the Object path. A {@link java.lang.ClassCastException} will be thrown if the object * cannot be casted to the expected type. */ public long getLong(String path) { //The type returned from Groovy depends on the input, so we need to handle different numerical types. Object value = get(path); if (value instanceof Long) { return (Long) value; } else if (value instanceof Short) { return ((Short) value).longValue(); } else if (value instanceof Integer) { return ((Integer) value).longValue(); } else { return ObjectConverter.convertObjectTo(value, Long.class); } }
private String format(Number o) { if (o instanceof Float) { return format(((Float) o).doubleValue()); } else if (o instanceof Double) { return format(((Double) o).doubleValue()); } 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; }
/** * Get the result of an Object path expression as a long. * * @param path The Object path. * @return The object matching the Object path. A {@link java.lang.ClassCastException} will be thrown if the object * cannot be casted to the expected type. */ public long getLong(String path) { //The type returned from Groovy depends on the input, so we need to handle different numerical types. Object value = get(path); if (value instanceof Long) { return (Long) value; } else if (value instanceof Short) { return ((Short) value).longValue(); } else if (value instanceof Integer) { return ((Integer) value).longValue(); } else { return ObjectConverter.convertObjectTo(value, Long.class); } }
return (T) (Long) ((Short) Short.parseShort(strValue)).longValue();
@SuppressWarnings({ "unchecked" }) @Override public <X> X unwrap(Short value, Class<X> type, WrapperOptions options) { if ( value == null ) { return null; } if ( Short.class.isAssignableFrom( type ) ) { return (X) value; } if ( Byte.class.isAssignableFrom( type ) ) { return (X) Byte.valueOf( value.byteValue() ); } 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
public void setValue(Object value, ValueFields valueFields) { if (value != null) { valueFields.setLongValue(((Short) value).longValue()); valueFields.setTextValue(value.toString()); } else { valueFields.setLongValue(null); valueFields.setTextValue(null); } }
toEncode = ((Short) value).longValue();
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); }
return new BigDecimal( ( (Byte) value ).longValue() ); } else if ( classType.equalsIgnoreCase( "java.lang.Short" ) ) { return new BigDecimal( ( (Short) value ).longValue() ); } else if ( classType.equalsIgnoreCase( "java.lang.Integer" ) ) { return new BigDecimal( ( (Integer) value ).longValue() );
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) {
case 16: assertTrue(obj instanceof Short); assertEquals(((Short) obj).longValue(), casted); break; case 8:
printLong(((Integer) unknown).longValue()); } else if (type == Short.class) { printLong(((Short) unknown).longValue()); } else if (type == Byte.class) { printLong(((Byte) unknown).longValue());
putInMapIfNotNull(data, Fields.VALUE_LONG, value.longValue()); putInMapIfNotNull(data, Fields.VALUE_DOUBLE, value.doubleValue());