/** * Finds the names of all the fields with the given annotation type * @param annotationType * the annotation type to look for on this field * @return the list of all field names sorted OR empty if none found */ public List<String> getFieldNamesWithAnnotation(Class<? extends Annotation> annotationType) { if (annotationType == null) { throw new IllegalArgumentException("annotationType must not be null"); } HashSet<String> fieldNames = new HashSet<String>(); Collection<ClassProperty> cps = namesToProperties.values(); for (ClassProperty classProperty : cps) { if (classProperty.getAnnotation(annotationType) != null) { fieldNames.add( classProperty.getFieldName() ); } } ArrayList<String> l = new ArrayList<String>(fieldNames); Collections.sort(l); return l; }
/** * Finds the names of all the fields with the given annotation type * @param annotationType * the annotation type to look for on this field * @return the list of all field names sorted OR empty if none found */ public List<String> getFieldNamesWithAnnotation(Class<? extends Annotation> annotationType) { if (annotationType == null) { throw new IllegalArgumentException("annotationType must not be null"); } HashSet<String> fieldNames = new HashSet<String>(); Collection<ClassProperty> cps = namesToProperties.values(); for (ClassProperty classProperty : cps) { if (classProperty.getAnnotation(annotationType) != null) { fieldNames.add( classProperty.getFieldName() ); } } ArrayList<String> l = new ArrayList<String>(fieldNames); Collections.sort(l); return l; }
/** * Will find the first field which has this annotation type * * @param annotationType * the annotation type to look for on this field * @return the name of the field which has this annotation OR null if none found */ public String getFieldNameByAnnotation(Class<? extends Annotation> annotationType) { if (annotationType == null) { throw new IllegalArgumentException("annotationType must not be null"); } String fieldName = null; Collection<ClassProperty> cps = namesToProperties.values(); for (ClassProperty classProperty : cps) { if (classProperty.getAnnotation(annotationType) != null) { fieldName = classProperty.getFieldName(); break; } } return fieldName; }
} catch (Exception e) { throw new FieldSetValueException("Field set failure setting value ("+value+") for name ("+cp.getFieldName()+") on: " + obj, cp.getFieldName(), value, obj, e); throw new FieldSetValueException("Setter method failure setting value ("+value+") for name ("+cp.getFieldName()+") on: " + obj, cp.getFieldName(), value, obj, e);
} catch (Exception e) { throw new FieldGetValueException("Field get failure getting value for name ("+cp.getFieldName()+") from: " + obj, cp.getFieldName(), obj, e); } catch (Exception e) { throw new FieldGetValueException("Getter method failure getting value for name ("+cp.getFieldName()+") from: " + obj, cp.getFieldName(), obj, e);
} catch (Exception e) { throw new FieldSetValueException("Field set failure setting value ("+value+") for name ("+cp.getFieldName()+") on: " + obj, cp.getFieldName(), value, obj, e); throw new FieldSetValueException("Setter method failure setting value ("+value+") for name ("+cp.getFieldName()+") on: " + obj, cp.getFieldName(), value, obj, e);
} catch (Exception e) { throw new FieldGetValueException("Field get failure getting value for name ("+cp.getFieldName()+") from: " + obj, cp.getFieldName(), obj, e); } catch (Exception e) { throw new FieldGetValueException("Getter method failure getting value for name ("+cp.getFieldName()+") from: " + obj, cp.getFieldName(), obj, e);
/** * Will find the first field which has this annotation type * * @param annotationType * the annotation type to look for on this field * @return the name of the field which has this annotation OR null if none found */ public String getFieldNameByAnnotation(Class<? extends Annotation> annotationType) { if (annotationType == null) { throw new IllegalArgumentException("annotationType must not be null"); } String fieldName = null; Collection<ClassProperty> cps = namesToProperties.values(); for (ClassProperty classProperty : cps) { if (classProperty.getAnnotation(annotationType) != null) { fieldName = classProperty.getFieldName(); break; } } return fieldName; }
+key+") value for name ("+cp.getFieldName()+") from: " + obj, cp.getFieldName(), obj, e);
+key+") value for name ("+cp.getFieldName()+") from: " + obj, cp.getFieldName(), obj, e);
+index+") value for name ("+cp.getFieldName()+") from: " + obj, cp.getFieldName(), obj, e);
continue; // skip any props with static fields if (ignoredFieldNames.contains(p.getFieldName())) { continue; // skip ignored names
+index+") value for name ("+cp.getFieldName()+") from: " + obj, cp.getFieldName(), obj, e);
continue; // skip any props with static fields if (ignoredFieldNames.contains(p.getFieldName())) { continue; // skip ignored names
+key+") value for name ("+cp.getFieldName()+") on: " + obj, cp.getFieldName(), obj, e);
+key+") value for name ("+cp.getFieldName()+") on: " + obj, cp.getFieldName(), obj, e);
+index+") value for name ("+cp.getFieldName()+") on: " + obj, cp.getFieldName(), obj, e);
+index+") value for name ("+cp.getFieldName()+") on: " + obj, cp.getFieldName(), obj, e);
List<ClassProperty> properties = findProperties(true); for (ClassProperty property : properties) { String fieldName = property.getFieldName(); namesToProperties.put(fieldName, property);
List<ClassProperty> properties = findProperties(true); for (ClassProperty property : properties) { String fieldName = property.getFieldName(); namesToProperties.put(fieldName, property);