/** * Will return the class of the injection resolver annotation type, or null if * no injection resolver annotation can be found * * @param desc The reified descriptor to find the injection resolution on * @return The annotation type for this injection resolver */ @SuppressWarnings("unchecked") public static Class<? extends Annotation> getInjectionResolverType(ActiveDescriptor<?> desc) { for (Type advertisedType : desc.getContractTypes()) { Class<?> rawClass = ReflectionHelper.getRawClass(advertisedType); if (!InjectionResolver.class.equals(rawClass)) continue; // Found the InjectionResolver if (!(advertisedType instanceof ParameterizedType)) { return null; } Type firstType = ReflectionHelper.getFirstTypeArgument(advertisedType); if (!(firstType instanceof Class)) { return null; } Class<?> retVal = (Class<?>) firstType; if (!Annotation.class.isAssignableFrom(retVal)) { return null; } return (Class<? extends Annotation>) retVal; } return null; }
/** * Checks to be sure the Factory class is ok * * @param factoryClass the class to check * @param collector the exception collector */ public static void checkFactoryType(Class<?> factoryClass, Collector collector) { for (Type type : factoryClass.getGenericInterfaces()) { Class<?> rawClass = ReflectionHelper.getRawClass(type); if (rawClass == null) continue; if (!Factory.class.equals(rawClass)) continue; Type firstType = ReflectionHelper.getFirstTypeArgument(type); if (firstType instanceof WildcardType) { // This should not be possible collector.addThrowable(new IllegalArgumentException("The class " + Pretty.clazz(factoryClass) + " has a Wildcard as its type")); } } }
/** * Checks to be sure the Factory class is ok * * @param factoryClass the class to check * @param collector the exception collector */ public static void checkFactoryType(Class<?> factoryClass, Collector collector) { for (Type type : factoryClass.getGenericInterfaces()) { Class<?> rawClass = ReflectionHelper.getRawClass(type); if (rawClass == null) continue; if (!Factory.class.equals(rawClass)) continue; Type firstType = ReflectionHelper.getFirstTypeArgument(type); if (firstType instanceof WildcardType) { // This should not be possible collector.addThrowable(new IllegalArgumentException("The class " + Pretty.clazz(factoryClass) + " has a Wildcard as its type")); } } }
/** * Checks to be sure the Factory class is ok * * @param factoryClass the class to check * @param collector the exception collector */ public static void checkFactoryType(Class<?> factoryClass, Collector collector) { for (Type type : factoryClass.getGenericInterfaces()) { Class<?> rawClass = ReflectionHelper.getRawClass(type); if (rawClass == null) continue; if (!Factory.class.equals(rawClass)) continue; Type firstType = ReflectionHelper.getFirstTypeArgument(type); if (firstType instanceof WildcardType) { // This should not be possible collector.addThrowable(new IllegalArgumentException("The class " + Pretty.clazz(factoryClass) + " has a Wildcard as its type")); } } }
/** * Checks to be sure the Factory class is ok * * @param factoryClass the class to check * @param collector the exception collector */ public static void checkFactoryType(Class<?> factoryClass, Collector collector) { for (Type type : factoryClass.getGenericInterfaces()) { Class<?> rawClass = ReflectionHelper.getRawClass(type); if (rawClass == null) continue; if (!Factory.class.equals(rawClass)) continue; Type firstType = ReflectionHelper.getFirstTypeArgument(type); if (firstType instanceof WildcardType) { // This should not be possible collector.addThrowable(new IllegalArgumentException("The class " + Pretty.clazz(factoryClass) + " has a Wildcard as its type")); } } }
/** * Will return the class of the injection resolver annotation type, or null if * no injection resolver annotation can be found * * @param desc The reified descriptor to find the injection resolution on * @return The annotation type for this injection resolver */ @SuppressWarnings("unchecked") public static Class<? extends Annotation> getInjectionResolverType(ActiveDescriptor<?> desc) { for (Type advertisedType : desc.getContractTypes()) { Class<?> rawClass = ReflectionHelper.getRawClass(advertisedType); if (!InjectionResolver.class.equals(rawClass)) continue; // Found the InjectionResolver if (!(advertisedType instanceof ParameterizedType)) { return null; } Type firstType = ReflectionHelper.getFirstTypeArgument(advertisedType); if (!(firstType instanceof Class)) { return null; } Class<?> retVal = (Class<?>) firstType; if (!Annotation.class.isAssignableFrom(retVal)) { return null; } return (Class<? extends Annotation>) retVal; } return null; }
/** * Will return the class of the injection resolver annotation type, or null if * no injection resolver annotation can be found * * @param desc The reified descriptor to find the injection resolution on * @return The annotation type for this injection resolver */ @SuppressWarnings("unchecked") public static Class<? extends Annotation> getInjectionResolverType(ActiveDescriptor<?> desc) { for (Type advertisedType : desc.getContractTypes()) { Class<?> rawClass = ReflectionHelper.getRawClass(advertisedType); if (!InjectionResolver.class.equals(rawClass)) continue; // Found the InjectionResolver if (!(advertisedType instanceof ParameterizedType)) { return null; } Type firstType = ReflectionHelper.getFirstTypeArgument(advertisedType); if (!(firstType instanceof Class)) { return null; } Class<?> retVal = (Class<?>) firstType; if (!Annotation.class.isAssignableFrom(retVal)) { return null; } return (Class<? extends Annotation>) retVal; } return null; }
/** * Will return the class of the injection resolver annotation type, or null if * no injection resolver annotation can be found * * @param desc The reified descriptor to find the injection resolution on * @return The annotation type for this injection resolver */ @SuppressWarnings("unchecked") public static Class<? extends Annotation> getInjectionResolverType(ActiveDescriptor<?> desc) { for (Type advertisedType : desc.getContractTypes()) { Class<?> rawClass = ReflectionHelper.getRawClass(advertisedType); if (!InjectionResolver.class.equals(rawClass)) continue; // Found the InjectionResolver if (!(advertisedType instanceof ParameterizedType)) { return null; } Type firstType = ReflectionHelper.getFirstTypeArgument(advertisedType); if (!(firstType instanceof Class)) { return null; } Class<?> retVal = (Class<?>) firstType; if (!Annotation.class.isAssignableFrom(retVal)) { return null; } return (Class<? extends Annotation>) retVal; } return null; }
boolean isIterable = IterableProvider.class.equals(rawType); Type requiredType = ReflectionHelper.getFirstTypeArgument(contractOrImpl); HashSet<Annotation> requiredQualifiers = new HashSet<Annotation>(); for (Annotation qualifier : qualifiers) {
boolean isIterable = IterableProvider.class.equals(rawType); Type requiredType = ReflectionHelper.getFirstTypeArgument(contractOrImpl); HashSet<Annotation> requiredQualifiers = new HashSet<Annotation>(); for (Annotation qualifier : qualifiers) {
boolean isIterable = IterableProvider.class.equals(rawType); Type requiredType = ReflectionHelper.getFirstTypeArgument(contractOrImpl); HashSet<Annotation> requiredQualifiers = new HashSet<Annotation>(); for (Annotation qualifier : qualifiers) {
boolean isIterable = IterableProvider.class.equals(rawType); Type requiredType = ReflectionHelper.getFirstTypeArgument(contractOrImpl); HashSet<Annotation> requiredQualifiers = new HashSet<Annotation>(); for (Annotation qualifier : qualifiers) {
(ReflectionHelper.getFirstTypeArgument(requiredType)), injectee.getRequiredQualifiers(), injectee.getUnqualified(), ReflectionHelper.getFirstTypeArgument(requiredType), injectee.getRequiredQualifiers());
(ReflectionHelper.getFirstTypeArgument(requiredType)), injectee.getRequiredQualifiers(), injectee.getUnqualified(), ReflectionHelper.getFirstTypeArgument(requiredType), injectee.getRequiredQualifiers());
(ReflectionHelper.getFirstTypeArgument(requiredType)), injectee.getRequiredQualifiers(), injectee.getUnqualified(), ReflectionHelper.getFirstTypeArgument(requiredType), injectee.getRequiredQualifiers());
(ReflectionHelper.getFirstTypeArgument(requiredType)), injectee.getRequiredQualifiers(), injectee.getUnqualified(), ReflectionHelper.getFirstTypeArgument(requiredType), injectee.getRequiredQualifiers());