JavaClassAccessor implements ClassAccessor { @Override public String toString() { return new ToStringBuilder(this) .append("javaClass", javaClass) .toString(); } protected  JavaClassAccessor(Class javaClass); static JavaClassAccessor getClassAccessor(Class javaClass); String getName(); @Override Class<?> getType(); PropertyAccessor getProperty(String propertyName); PropertyAccessor[] getProperties(); PropertyAccessor[] getKeyProperties(); Object newInstance(); boolean isAnnotationPresent(Class<? extends Annotation> annotationClass); T getAnnotation(Class<T> annotationClass); Annotation[] getAnnotations(); Annotation[] getDeclaredAnnotations(); Class getJavaClass(); @Override String toString(); static final String copyright; final static String[] PROPERTY_NAME_BLACKLIST; static final Logger logger; }
@Test(enabled = false) public void testJSON() { ClassAccessor javaClassAccessor = new JavaClassAccessor(TestBeanMultiPk.class); JSONStringer jsonStringer = new JSONStringer(); ReflectionUtil.classAccessorToJson(javaClassAccessor, jsonStringer); assertEquals( jsonStringer.toString(), "{\"name\":\"com.manydesigns.elements.reflection.JavaClassAccessorTest$TestBeanMultiPk\",\"keyProperties\":[\"key1\",\"key2\"],\"properties\":[{\"name\":\"key2\",\"type\":\"java.lang.String\",\"modifiers\":[\"public\"],\"label\":\"key2\",\"annotations\":[{\"type\":\"com.manydesigns.elements.annotations.Key\",\"properties\":{\"order\":2,\"name\":\"default\"}}]},{\"name\":\"key1\",\"type\":\"java.lang.String\",\"modifiers\":[\"public\"],\"label\":\"key1\",\"annotations\":[{\"type\":\"com.manydesigns.elements.annotations.Key\",\"properties\":{\"order\":1,\"name\":\"default\"}}]},{\"name\":\"alternateKey\",\"type\":\"java.lang.String\",\"modifiers\":[\"public\"],\"label\":\"alternate key\",\"annotations\":[{\"type\":\"com.manydesigns.elements.annotations.Key\",\"properties\":{\"order\":-2147483648,\"name\":\"alternate\"}}]},{\"name\":\"p1\",\"type\":\"java.lang.String\",\"modifiers\":[\"public\"],\"label\":\"p1\",\"annotations\":[]},{\"name\":\"p2\",\"type\":\"java.lang.String\",\"modifiers\":[\"public\"],\"label\":\"p2\",\"annotations\":[]}],\"annotations\":[]}"); }