/** * Matches a type by a another matcher that is applied on any of its declared fields. * * @param matcher The matcher that is applied onto each declared field. * @param <T> The type of the matched object. * @return A matcher that matches any type where another matcher is matched positively on at least on declared field. */ public static <T extends TypeDefinition> ElementMatcher.Junction<T> declaresField(ElementMatcher<? super FieldDescription> matcher) { return new DeclaringFieldMatcher<T>(new CollectionItemMatcher<FieldDescription>(matcher)); }