private Node getElementNode(Node node) { Short nodeType = Short.valueOf(node.getNodeType()); while (!ELEMENT_NODE.equals(nodeType)) { if (ELEMENT_NODE.equals(nodeType)) { return node; } node = node.getNextSibling(); if (node == null) { return null; } nodeType = Short.valueOf(node.getNodeType()); } return node; }
public static short[] toPrimitive(Short[] shortParam) { short[] shorts = new short[shortParam.length]; for (int i = 0; i < shortParam.length; i++) { shorts[i] = shortParam[i]; } return shorts; }
public static TestClassBundledGCM unbundle(Bundle bundle, Gson gson) { return new AutoValue_TestClassBundledGCM( bundle, Byte.parseByte(bundle.getString("some_byte")), Boolean.parseBoolean(bundle.getString("some_boolean")), Short.parseShort(bundle.getString("some_short")), Integer.parseInt(bundle.getString("some_int")), Long.parseLong(bundle.getString("some_long")), bundle.getString("some_char").charAt(0), Float.parseFloat(bundle.getString("some_float")), Double.parseDouble(bundle.getString("some_double")), bundle.getString("some_string"), bundle.getString("some_char_sequence"), gson.fromJson(bundle.getString("some_parcelable"), Parcelable.class), gson.fromJson(bundle.getString("some_parcelable_array_list"), new com.google.common.reflect.TypeToken<java.util.ArrayList<Parcelable>>(){}.getType()), gson.fromJson(bundle.getString("some_parcelable_sparse_array"), new com.google.common.reflect.TypeToken<android.util.SparseArray<Parcelable>>(){}.getType()), gson.fromJson(bundle.getString("some_serializable"), Serializable.class), gson.fromJson(bundle.getString("some_integer_array_list"), new com.google.common.reflect.TypeToken<java.util.ArrayList<Integer>>(){}.getType()), gson.fromJson(bundle.getString("some_string_array_list"), new com.google.common.reflect.TypeToken<java.util.ArrayList<String>>(){}.getType()), gson.fromJson(bundle.getString("some_char_sequence_array_list"), new com.google.common.reflect.TypeToken<java.util.ArrayList<CharSequence>>(){}.getType()), toPrimitive(gson.fromJson(bundle.getString("some_byte_array"), Byte[].class)), toPrimitive(gson.fromJson(bundle.getString("some_short_array"), Short[].class)), toPrimitive(gson.fromJson(bundle.getString("some_char_array"), Character[].class)), toPrimitive(gson.fromJson(bundle.getString("some_float_array"), Float[].class)), gson.fromJson(bundle.getString("some_unknown_object"), new com.google.common.reflect.TypeToken<UnknownObject>(){}.getType()), gson.fromJson(bundle.getString("some_unknown_object_list"), new com.google.common.reflect.TypeToken<ArrayList<UnknownObject>>(){}.getType()), gson.fromJson(bundle.getString("test_enum"), new com.google.common.reflect.TypeToken<TestEnum>(){}.getType())); }
public PrimitiveWrappersActivityScreen(Character field1, Integer field2, Double field3, Float field4, Boolean field5, Short field6, Byte field7, Long field8) { this.field1 = field1; this.field2 = field2; this.field3 = field3; this.field4 = field4; this.field5 = field5; this.field6 = field6; this.field7 = field7; this.field8 = field8; }
public static String createJsonAsString(ContentValues cv) { Set<Map.Entry<String, Object>> data = cv.valueSet(); Iterator<Map.Entry<String, Object>> iter = data.iterator(); final JSONObject json = new JSONObject(); while (iter.hasNext()) { Map.Entry<String, Object> entry = (Map.Entry<String, Object>)iter.next(); try { if (entry.getValue() instanceof String) { json.put(entry.getKey(), cv.getAsString(entry.getKey())); } else if (entry.getValue() instanceof Integer) { json.put(entry.getKey(), cv.getAsInteger(entry.getKey())); } else if (entry.getValue() instanceof Long) { json.put(entry.getKey(), cv.getAsLong(entry.getKey())); } else if (entry.getValue() instanceof Short) { json.put(entry.getKey(), cv.getAsShort(entry.getKey())); } else if (entry.getValue() instanceof Double) { json.put(entry.getKey(), cv.getAsDouble(entry.getKey())); } else if (entry.getValue() instanceof Boolean) { json.put(entry.getKey(), cv.getAsBoolean(entry.getKey())); } } catch (JSONException e) { e.printStackTrace(); return null; } } Log.d(TAG, "generated JSON = [" + json.toString() + "]"); return json.toString(); }
/** * {@inheritDoc} */ @Override @NonNull public BoxedTypesMethodsFactoryMethod mapFromCursor(@NonNull StorIOSQLite storIOSQLite, @NonNull Cursor cursor) { Boolean field1 = null; if (!cursor.isNull(cursor.getColumnIndex("field1"))) { field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1; } Short field2 = null; if (!cursor.isNull(cursor.getColumnIndex("field2"))) { field2 = cursor.getShort(cursor.getColumnIndex("field2")); } Integer field3 = null; if (!cursor.isNull(cursor.getColumnIndex("field3"))) { field3 = cursor.getInt(cursor.getColumnIndex("field3")); } Long field4 = null; if (!cursor.isNull(cursor.getColumnIndex("field4"))) { field4 = cursor.getLong(cursor.getColumnIndex("field4")); } Float field5 = null; if (!cursor.isNull(cursor.getColumnIndex("field5"))) { field5 = cursor.getFloat(cursor.getColumnIndex("field5")); } Double field6 = null; if (!cursor.isNull(cursor.getColumnIndex("field6"))) { field6 = cursor.getDouble(cursor.getColumnIndex("field6")); } BoxedTypesMethodsFactoryMethod object = BoxedTypesMethodsFactoryMethod.create(field1, field2, field3, field4, field5, field6); return object; }
/** * {@inheritDoc} */ @Override @NonNull public BoxedTypesPrivateFields mapFromCursor(@NonNull StorIOSQLite storIOSQLite, @NonNull Cursor cursor) { Boolean field1 = null; if (!cursor.isNull(cursor.getColumnIndex("field1"))) { field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1; } Short field2 = null; if (!cursor.isNull(cursor.getColumnIndex("field2"))) { field2 = cursor.getShort(cursor.getColumnIndex("field2")); } Integer field3 = null; if (!cursor.isNull(cursor.getColumnIndex("field3"))) { field3 = cursor.getInt(cursor.getColumnIndex("field3")); } Long field4 = null; if (!cursor.isNull(cursor.getColumnIndex("field4"))) { field4 = cursor.getLong(cursor.getColumnIndex("field4")); } Float field5 = null; if (!cursor.isNull(cursor.getColumnIndex("field5"))) { field5 = cursor.getFloat(cursor.getColumnIndex("field5")); } Double field6 = null; if (!cursor.isNull(cursor.getColumnIndex("field6"))) { field6 = cursor.getDouble(cursor.getColumnIndex("field6")); } BoxedTypesPrivateFields object = new BoxedTypesPrivateFields(field1, field2, field3, field4, field5, field6); return object; }
/** * {@inheritDoc} */ @Override @NonNull public BoxedTypesMethodsConstructor mapFromCursor(@NonNull StorIOSQLite storIOSQLite, @NonNull Cursor cursor) { Boolean field1 = null; if (!cursor.isNull(cursor.getColumnIndex("field1"))) { field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1; } Short field2 = null; if (!cursor.isNull(cursor.getColumnIndex("field2"))) { field2 = cursor.getShort(cursor.getColumnIndex("field2")); } Integer field3 = null; if (!cursor.isNull(cursor.getColumnIndex("field3"))) { field3 = cursor.getInt(cursor.getColumnIndex("field3")); } Long field4 = null; if (!cursor.isNull(cursor.getColumnIndex("field4"))) { field4 = cursor.getLong(cursor.getColumnIndex("field4")); } Float field5 = null; if (!cursor.isNull(cursor.getColumnIndex("field5"))) { field5 = cursor.getFloat(cursor.getColumnIndex("field5")); } Double field6 = null; if (!cursor.isNull(cursor.getColumnIndex("field6"))) { field6 = cursor.getDouble(cursor.getColumnIndex("field6")); } BoxedTypesMethodsConstructor object = new BoxedTypesMethodsConstructor(field1, field2, field3, field4, field5, field6); return object; }
/** * {@inheritDoc} */ @Override @NonNull public BoxedTypesPrivateFieldsIgnoreNull mapFromCursor(@NonNull StorIOSQLite storIOSQLite, @NonNull Cursor cursor) { Boolean field1 = null; if (!cursor.isNull(cursor.getColumnIndex("field1"))) { field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1; } Short field2 = null; if (!cursor.isNull(cursor.getColumnIndex("field2"))) { field2 = cursor.getShort(cursor.getColumnIndex("field2")); } Integer field3 = null; if (!cursor.isNull(cursor.getColumnIndex("field3"))) { field3 = cursor.getInt(cursor.getColumnIndex("field3")); } Long field4 = null; if (!cursor.isNull(cursor.getColumnIndex("field4"))) { field4 = cursor.getLong(cursor.getColumnIndex("field4")); } Float field5 = null; if (!cursor.isNull(cursor.getColumnIndex("field5"))) { field5 = cursor.getFloat(cursor.getColumnIndex("field5")); } Double field6 = null; if (!cursor.isNull(cursor.getColumnIndex("field6"))) { field6 = cursor.getDouble(cursor.getColumnIndex("field6")); } BoxedTypesPrivateFieldsIgnoreNull object = new BoxedTypesPrivateFieldsIgnoreNull(field1, field2, field3, field4, field5, field6); return object; }
/** * {@inheritDoc} */ @Override @NonNull public BoxedTypesMethodsConstructorIgnoreNull mapFromCursor(@NonNull StorIOSQLite storIOSQLite, @NonNull Cursor cursor) { Boolean field1 = null; if (!cursor.isNull(cursor.getColumnIndex("field1"))) { field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1; } Short field2 = null; if (!cursor.isNull(cursor.getColumnIndex("field2"))) { field2 = cursor.getShort(cursor.getColumnIndex("field2")); } Integer field3 = null; if (!cursor.isNull(cursor.getColumnIndex("field3"))) { field3 = cursor.getInt(cursor.getColumnIndex("field3")); } Long field4 = null; if (!cursor.isNull(cursor.getColumnIndex("field4"))) { field4 = cursor.getLong(cursor.getColumnIndex("field4")); } Float field5 = null; if (!cursor.isNull(cursor.getColumnIndex("field5"))) { field5 = cursor.getFloat(cursor.getColumnIndex("field5")); } Double field6 = null; if (!cursor.isNull(cursor.getColumnIndex("field6"))) { field6 = cursor.getDouble(cursor.getColumnIndex("field6")); } BoxedTypesMethodsConstructorIgnoreNull object = new BoxedTypesMethodsConstructorIgnoreNull(field1, field2, field3, field4, field5, field6); return object; }
/** * {@inheritDoc} */ @Override @NonNull public BoxedTypesMethodsFactoryMethodIgnoreNull mapFromCursor(@NonNull StorIOSQLite storIOSQLite, @NonNull Cursor cursor) { Boolean field1 = null; if (!cursor.isNull(cursor.getColumnIndex("field1"))) { field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1; } Short field2 = null; if (!cursor.isNull(cursor.getColumnIndex("field2"))) { field2 = cursor.getShort(cursor.getColumnIndex("field2")); } Integer field3 = null; if (!cursor.isNull(cursor.getColumnIndex("field3"))) { field3 = cursor.getInt(cursor.getColumnIndex("field3")); } Long field4 = null; if (!cursor.isNull(cursor.getColumnIndex("field4"))) { field4 = cursor.getLong(cursor.getColumnIndex("field4")); } Float field5 = null; if (!cursor.isNull(cursor.getColumnIndex("field5"))) { field5 = cursor.getFloat(cursor.getColumnIndex("field5")); } Double field6 = null; if (!cursor.isNull(cursor.getColumnIndex("field6"))) { field6 = cursor.getDouble(cursor.getColumnIndex("field6")); } BoxedTypesMethodsFactoryMethodIgnoreNull object = BoxedTypesMethodsFactoryMethodIgnoreNull.create(field1, field2, field3, field4, field5, field6); return object; }
/** * {@inheritDoc} */ @Override @NonNull public BoxedTypesMethodsFactoryMethod mapFromCursor(@NonNull StorIOContentResolver storIOContentResolver, @NonNull Cursor cursor) { Boolean field1 = null; if (!cursor.isNull(cursor.getColumnIndex("field1"))) { field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1; } Short field2 = null; if (!cursor.isNull(cursor.getColumnIndex("field2"))) { field2 = cursor.getShort(cursor.getColumnIndex("field2")); } Integer field3 = null; if (!cursor.isNull(cursor.getColumnIndex("field3"))) { field3 = cursor.getInt(cursor.getColumnIndex("field3")); } Long field4 = null; if (!cursor.isNull(cursor.getColumnIndex("field4"))) { field4 = cursor.getLong(cursor.getColumnIndex("field4")); } Float field5 = null; if (!cursor.isNull(cursor.getColumnIndex("field5"))) { field5 = cursor.getFloat(cursor.getColumnIndex("field5")); } Double field6 = null; if (!cursor.isNull(cursor.getColumnIndex("field6"))) { field6 = cursor.getDouble(cursor.getColumnIndex("field6")); } BoxedTypesMethodsFactoryMethod object = BoxedTypesMethodsFactoryMethod.create(field1, field2, field3, field4, field5, field6); return object; }
/** * {@inheritDoc} */ @Override @NonNull public BoxedTypesMethodsConstructor mapFromCursor(@NonNull StorIOContentResolver storIOContentResolver, @NonNull Cursor cursor) { Boolean field1 = null; if (!cursor.isNull(cursor.getColumnIndex("field1"))) { field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1; } Short field2 = null; if (!cursor.isNull(cursor.getColumnIndex("field2"))) { field2 = cursor.getShort(cursor.getColumnIndex("field2")); } Integer field3 = null; if (!cursor.isNull(cursor.getColumnIndex("field3"))) { field3 = cursor.getInt(cursor.getColumnIndex("field3")); } Long field4 = null; if (!cursor.isNull(cursor.getColumnIndex("field4"))) { field4 = cursor.getLong(cursor.getColumnIndex("field4")); } Float field5 = null; if (!cursor.isNull(cursor.getColumnIndex("field5"))) { field5 = cursor.getFloat(cursor.getColumnIndex("field5")); } Double field6 = null; if (!cursor.isNull(cursor.getColumnIndex("field6"))) { field6 = cursor.getDouble(cursor.getColumnIndex("field6")); } BoxedTypesMethodsConstructor object = new BoxedTypesMethodsConstructor(field1, field2, field3, field4, field5, field6); return object; }
/** * {@inheritDoc} */ @Override @NonNull public BoxedTypesMethodsConstructorIgnoreNull mapFromCursor(@NonNull StorIOContentResolver storIOContentResolver, @NonNull Cursor cursor) { Boolean field1 = null; if (!cursor.isNull(cursor.getColumnIndex("field1"))) { field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1; } Short field2 = null; if (!cursor.isNull(cursor.getColumnIndex("field2"))) { field2 = cursor.getShort(cursor.getColumnIndex("field2")); } Integer field3 = null; if (!cursor.isNull(cursor.getColumnIndex("field3"))) { field3 = cursor.getInt(cursor.getColumnIndex("field3")); } Long field4 = null; if (!cursor.isNull(cursor.getColumnIndex("field4"))) { field4 = cursor.getLong(cursor.getColumnIndex("field4")); } Float field5 = null; if (!cursor.isNull(cursor.getColumnIndex("field5"))) { field5 = cursor.getFloat(cursor.getColumnIndex("field5")); } Double field6 = null; if (!cursor.isNull(cursor.getColumnIndex("field6"))) { field6 = cursor.getDouble(cursor.getColumnIndex("field6")); } BoxedTypesMethodsConstructorIgnoreNull object = new BoxedTypesMethodsConstructorIgnoreNull(field1, field2, field3, field4, field5, field6); return object; }
/** * {@inheritDoc} */ @Override @NonNull public BoxedTypesPrivateFields mapFromCursor(@NonNull StorIOContentResolver storIOContentResolver, @NonNull Cursor cursor) { Boolean field1 = null; if (!cursor.isNull(cursor.getColumnIndex("field1"))) { field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1; } Short field2 = null; if (!cursor.isNull(cursor.getColumnIndex("field2"))) { field2 = cursor.getShort(cursor.getColumnIndex("field2")); } Integer field3 = null; if (!cursor.isNull(cursor.getColumnIndex("field3"))) { field3 = cursor.getInt(cursor.getColumnIndex("field3")); } Long field4 = null; if (!cursor.isNull(cursor.getColumnIndex("field4"))) { field4 = cursor.getLong(cursor.getColumnIndex("field4")); } Float field5 = null; if (!cursor.isNull(cursor.getColumnIndex("field5"))) { field5 = cursor.getFloat(cursor.getColumnIndex("field5")); } Double field6 = null; if (!cursor.isNull(cursor.getColumnIndex("field6"))) { field6 = cursor.getDouble(cursor.getColumnIndex("field6")); } BoxedTypesPrivateFields object = new BoxedTypesPrivateFields(field1, field2, field3, field4, field5, field6); return object; }
/** * {@inheritDoc} */ @Override @NonNull public BoxedTypesPrivateFieldsIgnoreNull mapFromCursor(@NonNull StorIOContentResolver storIOContentResolver, @NonNull Cursor cursor) { Boolean field1 = null; if (!cursor.isNull(cursor.getColumnIndex("field1"))) { field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1; } Short field2 = null; if (!cursor.isNull(cursor.getColumnIndex("field2"))) { field2 = cursor.getShort(cursor.getColumnIndex("field2")); } Integer field3 = null; if (!cursor.isNull(cursor.getColumnIndex("field3"))) { field3 = cursor.getInt(cursor.getColumnIndex("field3")); } Long field4 = null; if (!cursor.isNull(cursor.getColumnIndex("field4"))) { field4 = cursor.getLong(cursor.getColumnIndex("field4")); } Float field5 = null; if (!cursor.isNull(cursor.getColumnIndex("field5"))) { field5 = cursor.getFloat(cursor.getColumnIndex("field5")); } Double field6 = null; if (!cursor.isNull(cursor.getColumnIndex("field6"))) { field6 = cursor.getDouble(cursor.getColumnIndex("field6")); } BoxedTypesPrivateFieldsIgnoreNull object = new BoxedTypesPrivateFieldsIgnoreNull(field1, field2, field3, field4, field5, field6); return object; }
/** * {@inheritDoc} */ @Override @NonNull public BoxedTypesMethodsFactoryMethodIgnoreNull mapFromCursor(@NonNull StorIOContentResolver storIOContentResolver, @NonNull Cursor cursor) { Boolean field1 = null; if (!cursor.isNull(cursor.getColumnIndex("field1"))) { field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1; } Short field2 = null; if (!cursor.isNull(cursor.getColumnIndex("field2"))) { field2 = cursor.getShort(cursor.getColumnIndex("field2")); } Integer field3 = null; if (!cursor.isNull(cursor.getColumnIndex("field3"))) { field3 = cursor.getInt(cursor.getColumnIndex("field3")); } Long field4 = null; if (!cursor.isNull(cursor.getColumnIndex("field4"))) { field4 = cursor.getLong(cursor.getColumnIndex("field4")); } Float field5 = null; if (!cursor.isNull(cursor.getColumnIndex("field5"))) { field5 = cursor.getFloat(cursor.getColumnIndex("field5")); } Double field6 = null; if (!cursor.isNull(cursor.getColumnIndex("field6"))) { field6 = cursor.getDouble(cursor.getColumnIndex("field6")); } BoxedTypesMethodsFactoryMethodIgnoreNull object = BoxedTypesMethodsFactoryMethodIgnoreNull.create(field1, field2, field3, field4, field5, field6); return object; }
public static void main(String[] args) { Double d = new Double(0.0d); Float f = new Float(0.1f); Integer i = new Integer(1); Short s = Short.MIN_VALUE; }
public static int randomShort() { short limit = Short.MAX_VALUE; return randomInt(limit); }
public final void encode(Short object) throws IOException { this.encodeInteger(object); }
public final void encode(Object object) throws IOException { if (object == null) { this.encodeNil(); } else if (object instanceof Boolean) { this.encodeBoolean((Boolean) object); } else if (object instanceof Byte) { this.encodeInteger((Byte) object); } else if (object instanceof Short) { this.encodeInteger((Short) object); } else if (object instanceof Integer) { this.encodeInteger((Integer) object); } else if (object instanceof Long) { this.encodeInteger((Long) object); } else if (object instanceof Float) { this.encodeFloat((Float) object); } else if (object instanceof Double) { this.encodeFloat((Double) object); } else if (object instanceof String) { this.encodeString((String) object); } else if (object instanceof byte[]) { this.encodeBinary((byte[]) object); } else if (object instanceof List<?>) { this.encodeArray((List<?>) object); } else if (object instanceof Map<?, ?>) { this.encodeMap((Map<?, ?>) object); } else if (object instanceof Extended) { this.encodeExtended((Extended) object); } else { throw new IllegalArgumentException("MPack: no encoding available for objects of type " + object.getClass().toString()); } }