Enum Class AopEligibility.Rule
- All Implemented Interfaces:
Serializable,Comparable<AopEligibility.Rule>,java.lang.constant.Constable
- Enclosing class:
AopEligibility
AopEligibility.check(Class, Set) and AopEligibility.isProxyable(Method, Class) used to restate these
five conditions as two separately maintained if/else if chains, kept in sync
only by a javadoc sentence asking a human to remember. Each constant here supplies both
halves - violates(Method, Class) and describe(Method, Class) - as abstract
members, so a sixth rule fails to compile until both exist. That is what replaces the
sentence.
The two halves have deliberately different costs. violates does no string work at
all and is safe to call once per method per bean on the startup path. describe builds
the remediation text by concatenation and is called only when violates already
returned true, and only from AopEligibility.check(java.lang.Class<?>, java.util.Set<java.lang.reflect.Method>)'s reporting path - never from
AopEligibility.isProxyable(java.lang.reflect.Method, java.lang.Class<?>), which is the boolean query. Issue #317's literal proposal, a single
method returning a AopEligibility.Problem with isProxyable defined as that result being
absent, is rejected for exactly this reason: it would build and discard every rule's
diagnostic text on every boolean call. See issue #309.
Enum order is the previous chain's order, and AopEligibility.check(java.lang.Class<?>, java.util.Set<java.lang.reflect.Method>) and AopEligibility.isProxyable(java.lang.reflect.Method, java.lang.Class<?>) both
stop at the first violated rule - preserving the old chain's else-if semantics, where only
one problem is ever reported per method.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionFinal methods cannot be overridden, so the proxy cannot intercept them.Package-private and declared in a different package than the bean - relative to the bean class, not intrinsic to the method.Private methods are dispatched withinvokespecial, which bypasses the proxy.Hidden by a nearer declaration - usually the bridge method a generic override generates - also relative to the bean class.Static methods are dispatched withinvokestatic, which bypasses the proxy. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) final StringBuilds this rule's remediation text and records that it did so.(package private) abstract StringdescribeViolation(Method method, Class<?> beanClass) Builds this rule's remediation text.static AopEligibility.RuleReturns the enum constant of this class with the specified name.static AopEligibility.Rule[]values()Returns an array containing the constants of this enum class, in the order they are declared.(package private) abstract booleanCheap, string-free predicate.
-
Enum Constant Details
-
STATIC_METHOD
Static methods are dispatched withinvokestatic, which bypasses the proxy. -
PRIVATE_METHOD
Private methods are dispatched withinvokespecial, which bypasses the proxy. -
FINAL_METHOD
Final methods cannot be overridden, so the proxy cannot intercept them. -
INACCESSIBLE_METHOD
Package-private and declared in a different package than the bean - relative to the bean class, not intrinsic to the method. -
SHADOWED_METHOD
Hidden by a nearer declaration - usually the bridge method a generic override generates - also relative to the bean class.
-
-
Field Details
-
kind
-
-
Constructor Details
-
Rule
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
violates
Cheap, string-free predicate. Safe to call once per method per bean on the startup path.- Parameters:
method- the annotated methodbeanClass- the class the proxy would extend- Returns:
- true if this method violates this rule
-
describeViolation
Builds this rule's remediation text. Only ever called afterviolates(java.lang.reflect.Method, java.lang.Class<?>)already returned true for the same arguments.- Parameters:
method- the annotated methodbeanClass- the class the proxy would extend- Returns:
- actionable instructions for the module author
-
describe
Builds this rule's remediation text and records that it did so.The only caller is
AopEligibility.check(Class, Set)'s reporting path;AopEligibility.isProxyable(java.lang.reflect.Method, java.lang.Class<?>)must never reach this method.AopEligibility.DESCRIBE_CALLSis what lets a test prove that directly rather than only by reading the method body.
-