use of org.bedework.calfacade.annotations.NoDump in project bw-calendar-engine by Bedework.
the class DumpEntity method findGetters.
private Collection<ComparableMethod> findGetters(final Dump d, final DumpType dt) throws CalFacadeException {
Method[] meths = getClass().getMethods();
Collection<ComparableMethod> getters = new TreeSet<ComparableMethod>();
Collection<String> keyMethods = null;
if (dt == DumpType.reference) {
if ((d == null) || (d.keyFields().length == 0)) {
error("No key fields defined for class " + getClass().getCanonicalName());
throw new CalFacadeException(CalFacadeException.noKeyFields);
}
keyMethods = new ArrayList<String>();
for (String f : d.keyFields()) {
keyMethods.add(methodName(f));
}
}
for (int i = 0; i < meths.length; i++) {
Method m = meths[i];
String mname = m.getName();
if (mname.length() < 4) {
continue;
}
/* Name must start with get */
if (!mname.startsWith("get")) {
continue;
}
/* Don't want getClass */
if (mname.equals("getClass")) {
continue;
}
/* No parameters */
Class[] parClasses = m.getParameterTypes();
if (parClasses.length != 0) {
continue;
}
/* Not annotated with NoDump */
if (m.getAnnotation(NoDump.class) != null) {
continue;
}
/* If we have a list of key methods it must be in that list */
if ((keyMethods != null) && !keyMethods.contains(mname)) {
continue;
}
getters.add(new ComparableMethod(m));
}
return getters;
}
Aggregations