/** * Returns the missing properties exists in map but not exists in the given type. */ public static Set<String> checkMissingProperties(Class<?> type, Map map) { return JsonDecoder.checkMissingProperties(type, map); } }
/** * Parse the json string and returns the raw value. * * <p/> * The raw value may be : map, list, null or simple value. */ public static <T> T decode(String json){ return (T)decoder.decode(json); }
static Set<String> checkMissingProperties(Class<?> type, Map map) { Set<String> set = new LinkedHashSet<>(); doCheckMissingProperties(set, "", type, null, map); return set; }
String name = k.toString(); doCheckMissingProperties(set, prefix + name + ".", valueType, null, (Map)v); BeanProperty bp = findBeanProperty(bt, name); if(bp == null) { set.add(prefix + name); }else if(v instanceof Map) { doCheckMissingProperties(set, prefix + name + ".", bp.getType(), bp.getGenericType(), (Map)v); }else if(v instanceof List) { List list = (List)v; if(item instanceof Map) { String itemName = name + "[" + i + "]"; doCheckMissingProperties(set, prefix + itemName + ".", elementType, null, (Map)item);
/** * Parse the json string and returns the raw value. * * <p/> * The raw value may be : map, list, null or simple value. */ public static <T> T decode(Reader json){ return (T)decoder.decode(json); }
/** * Parse the json string and converts the raw value to the target type. */ public static <T> T decode(String json, Class<? extends T> targetType, Type genericType){ return Converts.convert(decoder.decode(json), targetType, genericType, convertContext); }
/** * Parse the json string and converts the raw value to the target type. */ public static <T> T decode(String json,Class<? extends T> targetType){ return Converts.convert(decoder.decode(json), targetType, null, convertContext); }
/** * Parse the json string and converts the raw value to the target type. */ public static <T> T decode(Reader json,Class<? extends T> targetType){ return Converts.convert(decoder.decode(json),targetType, null, convertContext); }
/** * Parse the json string and converts the raw value to the target type. */ public static <T> T decode(Reader json,Class<? extends T> targetType, Type genericType){ return Converts.convert(decoder.decode(json),targetType, genericType, convertContext); }