Examples of UseDataAdapter


Examples of com.geekhub.lessons.lessonSix.json.adapters.UseDataAdapter

            f.setAccessible(true);
            if (f.isAnnotationPresent(Ignore.class)) {
                continue;
            }
            if (f.isAnnotationPresent(UseDataAdapter.class)) {
                UseDataAdapter a = f.getAnnotation(UseDataAdapter.class);
                Class c = a.value();
                JsonDataAdapter adapter = (JsonDataAdapter) c.newInstance();
                result.put(f.getName(), adapter.toJson(f.get(o)));
            } else {
                result.put(f.getName(), serialize(f.get(o)));
            }
View Full Code Here

Examples of lesson06.json.adapters.UseDataAdapter

            PropertyDescriptor propertyDescriptor = new PropertyDescriptor(field.getName(), o.getClass());
            field.setAccessible(true);
            if (field.isAnnotationPresent(Ignore.class)) {
                continue;
            } else if (field.isAnnotationPresent(UseDataAdapter.class)) {
                UseDataAdapter adapter = field.getAnnotation(UseDataAdapter.class);
                jsonObject.put(field.getName(), adapter.value().newInstance().toJson(propertyDescriptor.getReadMethod().invoke(o)));
            } else {
                jsonObject.put(field.getName(), serialize(propertyDescriptor.getReadMethod().invoke(o)));
            }
            field.setAccessible(false);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.