@Test public void stringToChar() { assertEquals(JSON.charValue("Ahoj"), Character.valueOf('A')); }
public static Character charValue(Object val) { if (val instanceof Number) { return Character.toChars(numberValue(val).intValue())[0]; } if (val instanceof Boolean) { return (Boolean)val ? (char)1 : (char)0; } if (val instanceof String) { String s = (String)val; return s.isEmpty() ? (char)0 : s.charAt(0); } return (Character)val; }
JSON { public static Character charValue(Object val) { if (val instanceof Number) { return Character.toChars(numberValue(val).intValue())[0]; } if (val instanceof Boolean) { return (Boolean)val ? (char)1 : (char)0; } if (val instanceof String) { String s = (String)val; return s.isEmpty() ? (char)0 : s.charAt(0); } return (Character)val; } }
JSON { public static Character charValue(Object val) { if (val instanceof Number) { return Character.toChars(numberValue(val).intValue())[0]; } if (val instanceof Boolean) { return (Boolean)val ? (char)1 : (char)0; } if (val instanceof String) { String s = (String)val; return s.isEmpty() ? (char)0 : s.charAt(0); } return (Character)val; } private  JSON(); }
JSON { public static Character charValue(Object val) { if (val instanceof Number) { return Character.toChars(numberValue(val).intValue())[0]; } if (val instanceof Boolean) { return (Boolean)val ? (char)1 : (char)0; } if (val instanceof String) { String s = (String)val; return s.isEmpty() ? (char)0 : s.charAt(0); } return (Character)val; } private  JSON(); static Transfer findTransfer(BrwsrCtx c); static WSTransfer<?> findWSTransfer(BrwsrCtx c); static void readBindings(BrwsrCtx c, M model, Object value); static void extract(BrwsrCtx c, Object value, String[] props, Object[] values); static String toJSON(Object value); static String toString(BrwsrCtx c, Object obj, String prop); static Number toNumber(BrwsrCtx c, Object obj, String prop); static M toModel(BrwsrCtx c, Class<M> aClass, Object data, Object object); static boolean isSame(int a, int b); static boolean isSame(double a, double b); static boolean isSame(Object a, Object b); static int hashPlus(Object o, int h); static T extractValue(Class<T> type, Object val); static String stringValue(Object val); static Number numberValue(Object val); static Character charValue(Object val); static Boolean boolValue(Object val); static Object find(Object object, Bindings model); static Object find(Object object); static void applyBindings(Object object, String id); static void register(Class c, Proto.Type<?> type); static boolean isModel(Class<?> clazz); static Model bindTo(Model model, BrwsrCtx c); static T readStream(BrwsrCtx c, Class<T> modelClazz, InputStream data, Collection<? super T> collectTo); static T read(BrwsrCtx c, Class<T> modelClazz, Object data); }
JSON { public static Character charValue(Object val) { if (val instanceof Number) { return Character.toChars(numberValue(val).intValue())[0]; } if (val instanceof Boolean) { return (Boolean)val ? (char)1 : (char)0; } if (val instanceof String) { String s = (String)val; return s.isEmpty() ? (char)0 : s.charAt(0); } return (Character)val; } private  JSON(); static Transfer findTransfer(BrwsrCtx c); static WSTransfer<?> findWSTransfer(BrwsrCtx c); static void readBindings(BrwsrCtx c, M model, Object value); static void extract(BrwsrCtx c, Object value, String[] props, Object[] values); static String toJSON(Object value); static String toString(BrwsrCtx c, Object obj, String prop); static Number toNumber(BrwsrCtx c, Object obj, String prop); static M toModel(BrwsrCtx c, Class<M> aClass, Object data, Object object); static boolean isSame(int a, int b); static boolean isSame(double a, double b); static boolean isSame(Object a, Object b); static int hashPlus(Object o, int h); static T extractValue(Class<T> type, Object val); static String stringValue(Object val); static Number numberValue(Object val); static Character charValue(Object val); static Boolean boolValue(Object val); static Object find(Object object, Bindings model); static Object find(Object object); static void applyBindings(Object object, String id); static void register(Class c, Proto.Type<?> type); static boolean isModel(Class<?> clazz); static Model bindTo(Model model, BrwsrCtx c); static T readStream(BrwsrCtx c, Class<T> modelClazz, InputStream data, Collection<? super T> collectTo); static T read(BrwsrCtx c, Class<T> modelClazz, Object data);  }