@Override @SuppressWarnings("rawtypes") public Binding set(@Nonnull Class<? extends Annotation> param) { Preconditions.checkNotNull(param); // Parameter annotation appears on the alias target Class<? extends Annotation> real = Qualifiers.resolveAliases(param); final Parameter annot = real.getAnnotation(Parameter.class); if (annot == null) { throw new IllegalArgumentException(param.toString() + "has no Parameter annotation"); } Class<?> type = annot.value(); Binding<?> binding; if (type.equals(File.class)) { binding = LenskitBindingImpl.wrap(bind(File.class), new StringToFileConversion()); } else { binding = bind(annot.value()); } return binding.withQualifier(param); }
@Override public boolean apply(Annotation q) { // We test if the alias-resolved types match. Class<? extends Annotation> qtype = (q == null ? null : q.annotationType()); if (qtype == null) { return false; } else { Class<? extends Annotation> qact = resolveAliases(qtype); return actual.equals(qact); } }
public AnnotationClassMatcher(Class<? extends Annotation> type, DefaultMatcherPriority prio) { super(prio); Preconditions.notNull("type", type); Preconditions.isQualifier(type); this.type = type; // find the actual type to match (resolving aliases) actual = resolveAliases(type); }
@Override @SuppressWarnings("rawtypes") public Binding set(@Nonnull Class<? extends Annotation> param) { Preconditions.checkNotNull(param); // Parameter annotation appears on the alias target Class<? extends Annotation> real = Qualifiers.resolveAliases(param); final Parameter annot = real.getAnnotation(Parameter.class); if (annot == null) { throw new IllegalArgumentException(param.toString() + "has no Parameter annotation"); } Class<?> type = annot.value(); Binding<?> binding; if (type.equals(File.class)) { binding = LenskitBindingImpl.wrap(bind(File.class), new StringToFileConversion()); } else { binding = bind(annot.value()); } return binding.withQualifier(param); }
annotType = Qualifiers.resolveAliases(annotType);