@Test public void testGetPropertyInfoFields() { Assertions.assertEquals(PropUtils.getPropertyInfoFields(TestProp.class).length, 1); Assertions.assertEquals(PropUtils.getPropertyInfoFields(TestProp.class).length, 1); Assertions.assertEquals(PropUtils.getPropertyInfoFields(Object.class).length, 0); }
public static Field[] getPropertyInfoFields(final Class<?> clazz) { Field[] fields = fieldsMap.get(clazz); if (fields != null) { return fields; } final Field[] declaredFields = BeanHelper.getAllDeclaredFields(clazz); final List<Field> result = new LinkedList<Field>(); for (final Field field : declaredFields) { final PropertyInfo propertyInfo = field.getAnnotation(PropertyInfo.class); if (propertyInfo != null) { result.add(field); } } fields = result.toArray(EMPTY_FIELDS); fieldsMap.put(clazz, fields); return fields; }
PropUtils { public static Field[] getPropertyInfoFields(final Class<?> clazz) { Field[] fields = fieldsMap.get(clazz); if (fields != null) { return fields; } final Field[] declaredFields = BeanHelper.getAllDeclaredFields(clazz); final List<Field> result = new LinkedList<Field>(); for (final Field field : declaredFields) { final PropertyInfo propertyInfo = field.getAnnotation(PropertyInfo.class); if (propertyInfo != null) { result.add(field); } } fields = result.toArray(EMPTY_FIELDS); fieldsMap.put(clazz, fields); return fields; } }
PropUtils { public static Field[] getPropertyInfoFields(final Class<?> clazz) { Field[] fields = fieldsMap.get(clazz); if (fields != null) { return fields; } final Field[] declaredFields = BeanHelper.getAllDeclaredFields(clazz); final List<Field> result = new LinkedList<Field>(); for (final Field field : declaredFields) { final PropertyInfo propertyInfo = field.getAnnotation(PropertyInfo.class); if (propertyInfo != null) { result.add(field); } } fields = result.toArray(EMPTY_FIELDS); fieldsMap.put(clazz, fields); return fields; }  }
PropUtils { public static Field[] getPropertyInfoFields(final Class<?> clazz) { Field[] fields = fieldsMap.get(clazz); if (fields != null) { return fields; } final Field[] declaredFields = BeanHelper.getAllDeclaredFields(clazz); final List<Field> result = new LinkedList<Field>(); for (final Field field : declaredFields) { final PropertyInfo propertyInfo = field.getAnnotation(PropertyInfo.class); if (propertyInfo != null) { result.add(field); } } fields = result.toArray(EMPTY_FIELDS); fieldsMap.put(clazz, fields); return fields; }  static PropertyInfo get(final Class<?> clazz, final String property); static PropertyInfo get(final Field field); static Field getField(final Class<?> clazz, final String property); static Field getField(final Class<?> clazz, final String property, boolean suppressWarning); static String getI18nKey(final Class<?> clazz, final String property); static Field[] getPropertyInfoFields(final Class<?> clazz); }
PropUtils { public static Field[] getPropertyInfoFields(final Class<?> clazz) { Field[] fields = fieldsMap.get(clazz); if (fields != null) { return fields; } final Field[] declaredFields = BeanHelper.getAllDeclaredFields(clazz); final List<Field> result = new LinkedList<Field>(); for (final Field field : declaredFields) { final PropertyInfo propertyInfo = field.getAnnotation(PropertyInfo.class); if (propertyInfo != null) { result.add(field); } } fields = result.toArray(EMPTY_FIELDS); fieldsMap.put(clazz, fields); return fields; }  static PropertyInfo get(final Class<?> clazz, final String property); static PropertyInfo get(final Field field); static Field getField(final Class<?> clazz, final String property); static Field getField(final Class<?> clazz, final String property, boolean suppressWarning); static String getI18nKey(final Class<?> clazz, final String property); static Field[] getPropertyInfoFields(final Class<?> clazz);  }