Added BooleanProvider#hidden

This commit is contained in:
Rsl1122 2019-03-24 15:34:45 +02:00
parent 60f5571e42
commit 2b620f97f1
2 changed files with 11 additions and 0 deletions

View File

@ -79,6 +79,13 @@ public @interface BooleanProvider {
*/
String conditionName() default "";
/**
* Should the result of this method be hidden from the user.
*
* @return true if the value should not be displayed on the page.
*/
boolean hidden() default false;
/**
* Name of Font Awesome icon.
* <p>

View File

@ -181,6 +181,10 @@ public final class ExtensionExtractor {
if (annotation.conditionName().equals(condition)) {
warnings.add(extensionName + "." + method.getName() + " can not be conditional of itself. required condition: " + condition + ", provided condition: " + annotation.conditionName());
}
if (annotation.conditionName().isEmpty() && annotation.hidden()) {
throw new IllegalArgumentException(extensionName + "." + method.getName() + " can not be 'hidden' without a 'conditionName'");
}
}
}