@Test public void listPseudoPropertyNamesテスト() { String[] props = Beans.listPseudoPropertyNames(BeansBeanAlternative.class); assertEquals("プロパティの数", 7, props.length); }
public static String[] listPseudoPropertyNames(Class<?> clazz) { List<String> names = new ArrayList<String>(); for (PropertyDescriptor pd : Beans.findPropertyDescriptorsFor(clazz)) { names.add(pd.getName()); } for (Field f : clazz.getFields()) { String n = f.getName(); if (!names.contains(n)) names.add(n); } return names.toArray(new String[0]); }
Beans { public static String[] listPseudoPropertyNames(Class<?> clazz) { List<String> names = new ArrayList<String>(); for (PropertyDescriptor pd : Beans.findPropertyDescriptorsFor(clazz)) { names.add(pd.getName()); } for (Field f : clazz.getFields()) { String n = f.getName(); if (!names.contains(n)) names.add(n); } return names.toArray(new String[0]); } }
Beans { public static String[] listPseudoPropertyNames(Class<?> clazz) { List<String> names = new ArrayList<String>(); for (PropertyDescriptor pd : Beans.findPropertyDescriptorsFor(clazz)) { names.add(pd.getName()); } for (Field f : clazz.getFields()) { String n = f.getName(); if (!names.contains(n)) names.add(n); } return names.toArray(new String[0]); } private  Beans(); }
Beans { public static String[] listPseudoPropertyNames(Class<?> clazz) { List<String> names = new ArrayList<String>(); for (PropertyDescriptor pd : Beans.findPropertyDescriptorsFor(clazz)) { names.add(pd.getName()); } for (Field f : clazz.getFields()) { String n = f.getName(); if (!names.contains(n)) names.add(n); } return names.toArray(new String[0]); } private  Beans(); static String capitalize(String capitalizee); static String decapitalize(String decapitalizee); static String decapitalize(String decapitalizee, boolean doubleUppercaseEnable); static boolean isPropertyReader(String suspect); static boolean isPropertyWriter(String suspect); static boolean isPropertyAccessor(String suspect); static String generatePropertyNameFor(String accessorName); static T make(Class<T> clazz); static PropertyDescriptor[] findPropertyDescriptorsFor(Class<?> clazz); static PropertyDescriptor findPropertyDescriptorFor(Class<?> clazz, String propertyName); static Object readPropertyValueNamed(String propertyName, Object bean); static void writePropertyValueNamed(String propertyName, Object bean, Object newValue); static Object readPseudoPropertyValueNamed(String propertyName, Object bean); static void writePseudoPropertyValueNamed(String propertyName, Object bean, Object newValue); static String[] listPseudoPropertyNames(Class<?> clazz); static Class<?> detectDeclaredPropertyType(String propertyName, Class<?> target); }
Beans { public static String[] listPseudoPropertyNames(Class<?> clazz) { List<String> names = new ArrayList<String>(); for (PropertyDescriptor pd : Beans.findPropertyDescriptorsFor(clazz)) { names.add(pd.getName()); } for (Field f : clazz.getFields()) { String n = f.getName(); if (!names.contains(n)) names.add(n); } return names.toArray(new String[0]); } private  Beans(); static String capitalize(String capitalizee); static String decapitalize(String decapitalizee); static String decapitalize(String decapitalizee, boolean doubleUppercaseEnable); static boolean isPropertyReader(String suspect); static boolean isPropertyWriter(String suspect); static boolean isPropertyAccessor(String suspect); static String generatePropertyNameFor(String accessorName); static T make(Class<T> clazz); static PropertyDescriptor[] findPropertyDescriptorsFor(Class<?> clazz); static PropertyDescriptor findPropertyDescriptorFor(Class<?> clazz, String propertyName); static Object readPropertyValueNamed(String propertyName, Object bean); static void writePropertyValueNamed(String propertyName, Object bean, Object newValue); static Object readPseudoPropertyValueNamed(String propertyName, Object bean); static void writePseudoPropertyValueNamed(String propertyName, Object bean, Object newValue); static String[] listPseudoPropertyNames(Class<?> clazz); static Class<?> detectDeclaredPropertyType(String propertyName, Class<?> target);  }