use of org.apache.felix.ipojo.manipulator.spi.Predicate in project felix by apache.
the class Predicates method onlySupportedElements.
/**
* Restrict to the supported {@link ElementType}(s) of the annotation (use the @Target, if provided).
* @param annotationType annotation to explore
*/
public static Predicate onlySupportedElements(final Class<? extends Annotation> annotationType) {
Target target = annotationType.getAnnotation(Target.class);
if (target == null) {
return alwaysTrue();
}
Collection<Predicate> supportedTypes = new HashSet<Predicate>();
for (ElementType type : target.value()) {
supportedTypes.add(on(type));
}
return or(supportedTypes);
}
Aggregations