Fix error filtering reports

Fixes #718
This commit is contained in:
Dan Mulloy 2019-12-05 17:02:16 -05:00
parent 6d9fe45fb4
commit b4d4eb29af
No known key found for this signature in database
GPG Key ID: 2B62F7DACFF133E8

View File

@ -55,7 +55,7 @@ public class ReportType {
*/ */
public static Class<?> getSenderClass(Object sender) { public static Class<?> getSenderClass(Object sender) {
if (sender == null) if (sender == null)
throw new IllegalArgumentException("sender cannot be NUll."); throw new IllegalArgumentException("sender cannot be null.");
else if (sender instanceof Class<?>) else if (sender instanceof Class<?>)
return (Class<?>) sender; return (Class<?>) sender;
else else
@ -75,7 +75,7 @@ public class ReportType {
*/ */
public static String getReportName(Object sender, ReportType type) { public static String getReportName(Object sender, ReportType type) {
if (sender == null) if (sender == null)
throw new IllegalArgumentException("sender cannot be NUll."); throw new IllegalArgumentException("sender cannot be null.");
return getReportName(getSenderClass(sender), type); return getReportName(getSenderClass(sender), type);
} }
@ -83,13 +83,13 @@ public class ReportType {
* Retrieve the full canonical name of a given report type. * Retrieve the full canonical name of a given report type.
* <p> * <p>
* This is in the format <i>canonical_name_of_class#report_type</i> * This is in the format <i>canonical_name_of_class#report_type</i>
* @param clazz - the sender class. * @param sender - the sender class.
* @param type - the report instance. * @param type - the report instance.
* @return The full canonical name. * @return The full canonical name.
*/ */
private static String getReportName(Class<?> sender, ReportType type) { private static String getReportName(Class<?> sender, ReportType type) {
if (sender == null) if (sender == null)
throw new IllegalArgumentException("sender cannot be NUll."); throw new IllegalArgumentException("sender cannot be null.");
// Whether or not we need to retrieve the report name again // Whether or not we need to retrieve the report name again
if (type.reportName == null) { if (type.reportName == null) {
@ -138,11 +138,10 @@ public class ReportType {
* @return All associated report fields. * @return All associated report fields.
*/ */
private static List<Field> getReportFields(Class<?> clazz) { private static List<Field> getReportFields(Class<?> clazz) {
return FuzzyReflection.fromClass(clazz).getFieldList( return FuzzyReflection.fromClass(clazz, true)
FuzzyFieldContract.newBuilder(). .getFieldList(FuzzyFieldContract.newBuilder()
requireModifier(Modifier.STATIC). .requireModifier(Modifier.STATIC)
typeDerivedOf(ReportType.class). .typeDerivedOf(ReportType.class)
build() .build());
);
} }
} }