public Short toShort(Long self) { return self.shortValue(); }
@Override public short getShort(String name) { return ((Long) decode(SMALLINT, getFieldValue(name))).shortValue(); }
public Object getValue(ValueFields valueFields) { if (valueFields.getLongValue() != null) { return new Short(valueFields.getLongValue().shortValue()); } return null; }
/** * Get the result of an Object path expression as a short. * * @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 short getShort(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 Short) { return (Short) value; } else if (value instanceof Long) { return ((Long) value).shortValue(); } else if (value instanceof Integer) { return ((Integer) value).shortValue(); } else { return ObjectConverter.convertObjectTo(value, Short.class); } }
/** * Get the result of an Object path expression as a short. * * @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 short getShort(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 Short) { return (Short) value; } else if (value instanceof Long) { return ((Long) value).shortValue(); } else if (value instanceof Integer) { return ((Integer) value).shortValue(); } else { return ObjectConverter.convertObjectTo(value, Short.class); } }
return (X) Short.valueOf( value.shortValue() );
return ((Long) nativeValue).shortValue();
@SuppressWarnings("incomplete-switch") @Override public void visitConstStmt(Op op, int ra, Object value) { switch (op) { case CONST_WIDE_16: { Long v = (Long) value; value = (int) v.shortValue(); break; } case CONST_WIDE_HIGH16: { Long v = (Long) value; value = (int) ((short) (v >> 48)); break; } case CONST_WIDE_32: { Long v = (Long) value; value = (int) v.intValue(); break; } case CONST_HIGH16: { Integer v = (Integer) value; value = (int) v.intValue() >> 16; break; } } out.s("%s %s, %s", op.displayName, reg(ra), BaksmaliDumper.escapeValue(value)); super.visitConstStmt(op, ra, value); }
} else if (targetClass == Short.class) { checkRange(l, Short.MIN_VALUE, Short.MAX_VALUE); return (T) (Short) l.shortValue(); } else if (targetClass == Integer.class) { checkRange(l, Integer.MIN_VALUE, Integer.MAX_VALUE);
@Test public void testSmallInt() throws Exception { AccumuloRowSerializer serializer = serializerClass.getConstructor().newInstance(); Type type = SMALLINT; Short expected = 12345; byte[] data = serializer.encode(type, expected); Short actual = ((Long) serializer.decode(type, data)).shortValue(); assertEquals(actual, expected); deserializeData(serializer, data); actual = serializer.getShort(COLUMN_NAME); assertEquals(actual, expected); }
return ((Long) value).shortValue();
case Types.SMALLINT: case Types.TINYINT: return new PGShort( new Short( val.shortValue() )); case Types.DECIMAL: case Types.NUMERIC:
value = getInputRowMeta().getInteger( r, index ).byteValue(); } else if ( clazz.equals( Short.class ) || clazz.equals( short.class ) ) { value = getInputRowMeta().getInteger( r, index ).shortValue(); } else if ( clazz.equals( Integer.class ) || clazz.equals( int.class ) ) { value = getInputRowMeta().getInteger( r, index ).intValue();
} else { if ( length < 5 ) { values[i] = new Short( valueMeta.getInteger( valueData ).shortValue() ); } else { values[i] = valueMeta.getInteger( valueData );
public ShortValue readValue(ValueFields valueFields) { Long longValue = valueFields.getLongValue(); Short shortValue = null; if(longValue != null) { shortValue = Short.valueOf(longValue.shortValue()); } return Variables.shortValue(shortValue); }
public ShortValue readValue(ValueFields valueFields) { Long longValue = valueFields.getLongValue(); Short shortValue = null; if(longValue != null) { shortValue = Short.valueOf(longValue.shortValue()); } return Variables.shortValue(shortValue); }
@SuppressWarnings("unchecked") @Override public <T> T convertTo(Serializable value, Class<T> toType) throws PropertyConversionException { if (value == null || Long.class == toType) { return (T) value; } Long v = (Long) value; if (toType == Integer.class) { return (T) new Integer(v.intValue()); } if (toType == String.class) { return (T) v.toString(); } if (toType == Double.class) { return (T) new Double(v.doubleValue()); } if (toType == Float.class) { return (T) new Float(v.floatValue()); } if (toType == Short.class) { return (T) new Short(v.shortValue()); } if (toType == Byte.class) { return (T) new Byte(v.byteValue()); } throw new PropertyConversionException(value.getClass(), toType); }
minValue == null ? null : minValue.shortValue(), maxValue == null ? null : maxValue.shortValue(), random.nextLong() );
public Short convert(Object o) { if (((Long) o) > Short.MAX_VALUE) { throw new ConversionException("cannot coerce Integer to Short since the value (" + valueOf(o) + ") exceeds that maximum precision of Integer."); } else { return ((Long) o).shortValue(); } } }
if (_accountMgr.isRootAdmin(account.getId()) && max.shortValue() != Resource.RESOURCE_UNLIMITED) { throw new InvalidParameterValueException("Only " + Resource.RESOURCE_UNLIMITED + " limit is supported for Root Admin accounts");