/** * Encode a value object when the wire format type is known. This method * should be preferred over {@link #encode(Object)} when possible. */ public static Splittable encode(Class<?> clazz, Object obj) { if (obj == null) { return Splittable.NULL; } return getTypeOrDie(clazz).encode(obj); }
@SuppressWarnings("unchecked") public static <T> T decode(Class<T> clazz, Splittable split) { if (split == null || split == Splittable.NULL) { return null; } return (T) getTypeOrDie(clazz).decode(clazz, split); }
/** * Returns the uninitialized field value for the given primitive type. */ public static Object getUninitializedFieldValue(Class<?> clazz) { Type type = getTypeOrDie(clazz); if (clazz.equals(type.getPrimitiveType())) { return type.getDefaultValue(); } return null; }
/** * Encode a value object when the wire format type is known. This method * should be preferred over {@link #encode(Object)} when possible. */ public static Splittable encode(Class<?> clazz, Object obj) { if (obj == null) { return Splittable.NULL; } return getTypeOrDie(clazz).encode(obj); }
@SuppressWarnings("unchecked") public static <T> T decode(Class<T> clazz, Splittable split) { if (split == null || split == Splittable.NULL) { return null; } return (T) getTypeOrDie(clazz).decode(clazz, split); }
@SuppressWarnings("unchecked") public static <T> T decode(Class<T> clazz, Splittable split) { if (split == null || split == Splittable.NULL) { return null; } return (T) getTypeOrDie(clazz).decode(clazz, split); }
@SuppressWarnings("unchecked") public static <T> T decode(Class<T> clazz, Splittable split) { if (split == null || split == Splittable.NULL) { return null; } return (T) getTypeOrDie(clazz).decode(clazz, split); }
/** * Encode a value object when the wire format type is known. This method * should be preferred over {@link #encode(Object)} when possible. */ public static Splittable encode(Class<?> clazz, Object obj) { if (obj == null) { return Splittable.NULL; } return getTypeOrDie(clazz).encode(obj); }
/** * Encode a value object when the wire format type is known. This method * should be preferred over {@link #encode(Object)} when possible. */ public static Splittable encode(Class<?> clazz, Object obj) { if (obj == null) { return Splittable.NULL; } return getTypeOrDie(clazz).encode(obj); }
/** * Returns the uninitialized field value for the given primitive type. */ public static Object getUninitializedFieldValue(Class<?> clazz) { Type type = getTypeOrDie(clazz); if (clazz.equals(type.getPrimitiveType())) { return type.getDefaultValue(); } return null; }
/** * Returns the uninitialized field value for the given primitive type. */ public static Object getUninitializedFieldValue(Class<?> clazz) { Type type = getTypeOrDie(clazz); if (clazz.equals(type.getPrimitiveType())) { return type.getDefaultValue(); } return null; }
/** * Returns the uninitialized field value for the given primitive type. */ public static Object getUninitializedFieldValue(Class<?> clazz) { Type type = getTypeOrDie(clazz); if (clazz.equals(type.getPrimitiveType())) { return type.getDefaultValue(); } return null; }