Skip to content

Commit

Permalink
fixup! extend Onion Architecture to allow defining components by pred…
Browse files Browse the repository at this point in the history
…icate

Tried to improve Javadoc of `belongTo...()`

Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
  • Loading branch information
codecholeric committed Jun 25, 2022
1 parent a833def commit 4ec3581
Showing 1 changed file with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2355,7 +2355,27 @@ public static DescribedPredicate<JavaClass> equivalentTo(final Class<?> clazz) {

/**
* A predicate to determine if a {@link JavaClass} "belongs" to one of the passed {@link Class classes},
* where we define "belong" as being equivalent to the class itself or any inner/anonymous class of this class.
* where "belong" means that this {@link JavaClass} is equivalent to
* <ul>
* <li>any of the passed {@link Class classes}</li>
* <li>any nested/inner/anonymous class of one of the passed {@link Class classes}</li>
* </ul>
*
* For example {@code belongToAnyOf(Outer.class)} would apply to the following cases
* <pre><code>
* class Outer {
* // Inner would match belongToAnyOf(Outer.class) since it is an inner class of Outer
* class Inner {}
*
* void call() {
* // this anonymous class would also match belongToAnyOf(Outer.class) since it is declared within Outer
* new Serializable() {}
* }
* }
*
* // this class would not match, since it is neither Outer itself nor nested within the class body of Outer
* class Other {}
* </code></pre>
*
* @param classes The {@link Class classes} to check the {@link JavaClass} and its enclosing classes against
* @return A {@link DescribedPredicate} returning true, if and only if the tested {@link JavaClass} is equivalent to
Expand All @@ -2373,8 +2393,12 @@ public static DescribedPredicate<JavaClass> belongToAnyOf(Class<?>... classes) {

/**
* A predicate to determine if a {@link JavaClass} "belongs" to a class matching the given predicate,
* where we define "belong" as being equivalent to the class itself or any inner/anonymous class of this class.
* <br><br>
* where "belong" means that this {@link JavaClass} is
* <ul>
* <li>directly matching the given predicate</li>
* <li>a nested/inner/anonymous class of another {@link JavaClass} matching the predicate</li>
* </ul>
*
* For example {@code belongTo(annotatedWith(Something.class))} would apply to the following cases
* <pre><code>
*{@literal @}Something
Expand Down

0 comments on commit 4ec3581

Please sign in to comment.