public static Splittable encode(Object obj) { if (obj == null) { return Splittable.NULL; } Type t = findType(obj.getClass()); // Try upcasting if (t == null) { for (Type maybe : Type.values()) { if (maybe.canUpcast(obj)) { t = maybe; break; } } } if (t == null) { throw new UnsupportedOperationException(obj.getClass().getName()); } return t.encode(obj); }
public static Splittable encode(Object obj) { if (obj == null) { return Splittable.NULL; } Type t = findType(obj.getClass()); // Try upcasting if (t == null) { for (Type maybe : Type.values()) { if (maybe.canUpcast(obj)) { t = maybe; break; } } } if (t == null) { throw new UnsupportedOperationException(obj.getClass().getName()); } return t.encode(obj); }
public static Splittable encode(Object obj) { if (obj == null) { return Splittable.NULL; } Type t = findType(obj.getClass()); // Try upcasting if (t == null) { for (Type maybe : Type.values()) { if (maybe.canUpcast(obj)) { t = maybe; break; } } } if (t == null) { throw new UnsupportedOperationException(obj.getClass().getName()); } return t.encode(obj); }
public static Splittable encode(Object obj) { if (obj == null) { return Splittable.NULL; } Type t = findType(obj.getClass()); // Try upcasting if (t == null) { for (Type maybe : Type.values()) { if (maybe.canUpcast(obj)) { t = maybe; break; } } } if (t == null) { throw new UnsupportedOperationException(obj.getClass().getName()); } return t.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); }
/** * 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); }
/** * 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); }