/** * Returns all instance method and field injection points on {@code type}. * * @return a possibly empty set of injection points. The set has a specified iteration order. All * fields are returned and then all methods. Within the fields, supertype fields are returned * before subtype fields. Similarly, supertype methods are returned before subtype methods. * @throws ConfigurationException if there is a malformed injection point on {@code type}, such as * a field with multiple binding annotations. The exception's {@link * ConfigurationException#getPartialValue() partial value} is a {@code Set<InjectionPoint>} * of the valid injection points. */ public static Set<InjectionPoint> forInstanceMethodsAndFields(TypeLiteral<?> type) { Set<InjectionPoint> result = new HashSet<>(); Errors errors = new Errors(); // TODO (crazybob): Filter out overridden members. addInjectionPoints(type, Factory.FIELDS, false, result, errors); addInjectionPoints(type, Factory.METHODS, false, result, errors); result = unmodifiableSet(result); if (errors.hasErrors()) { throw new ConfigurationException(errors.getMessages()).withPartialValue(result); } return result; }
/** * Returns all static method and field injection points on {@code type}. * * @return a possibly empty set of injection points. The set has a specified iteration order. All * fields are returned and then all methods. Within the fields, supertype fields are returned * before subtype fields. Similarly, supertype methods are returned before subtype methods. * @throws ConfigurationException if there is a malformed injection point on {@code type}, such as * a field with multiple binding annotations. The exception's {@link * ConfigurationException#getPartialValue() partial value} is a {@code Set<InjectionPoint>} * of the valid injection points. */ public static Set<InjectionPoint> forStaticMethodsAndFields(TypeLiteral type) { Set<InjectionPoint> result = new HashSet<>(); Errors errors = new Errors(); addInjectionPoints(type, Factory.FIELDS, true, result, errors); addInjectionPoints(type, Factory.METHODS, true, result, errors); result = unmodifiableSet(result); if (errors.hasErrors()) { throw new ConfigurationException(errors.getMessages()).withPartialValue(result); } return result; }
private static <M extends Member & AnnotatedElement> void addInjectionPoints(TypeLiteral<?> type, Factory<M> factory, boolean statics, Collection<InjectionPoint> injectionPoints, Errors errors) { if (type.getType() == Object.class) { return; } // Add injectors for superclass first. TypeLiteral<?> superType = type.getSupertype(type.getRawType().getSuperclass()); addInjectionPoints(superType, factory, statics, injectionPoints, errors); // Add injectors for all members next addInjectorsForMembers(type, factory, statics, injectionPoints, errors); }
/** * Returns all static method and field injection points on {@code type}. * * @return a possibly empty set of injection points. The set has a specified iteration order. All * fields are returned and then all methods. Within the fields, supertype fields are returned * before subtype fields. Similarly, supertype methods are returned before subtype methods. * @throws ConfigurationException if there is a malformed injection point on {@code type}, such as * a field with multiple binding annotations. The exception's {@link * ConfigurationException#getPartialValue() partial value} is a {@code Set<InjectionPoint>} * of the valid injection points. */ public static Set<InjectionPoint> forStaticMethodsAndFields(TypeLiteral type) { Set<InjectionPoint> result = new HashSet<>(); Errors errors = new Errors(); addInjectionPoints(type, Factory.FIELDS, true, result, errors); addInjectionPoints(type, Factory.METHODS, true, result, errors); result = unmodifiableSet(result); if (errors.hasErrors()) { throw new ConfigurationException(errors.getMessages()).withPartialValue(result); } return result; }
/** * Returns all static method and field injection points on {@code type}. * * @return a possibly empty set of injection points. The set has a specified iteration order. All * fields are returned and then all methods. Within the fields, supertype fields are returned * before subtype fields. Similarly, supertype methods are returned before subtype methods. * @throws ConfigurationException if there is a malformed injection point on {@code type}, such as * a field with multiple binding annotations. The exception's {@link * ConfigurationException#getPartialValue() partial value} is a {@code Set<InjectionPoint>} * of the valid injection points. */ public static Set<InjectionPoint> forStaticMethodsAndFields(TypeLiteral type) { Set<InjectionPoint> result = new HashSet<>(); Errors errors = new Errors(); addInjectionPoints(type, Factory.FIELDS, true, result, errors); addInjectionPoints(type, Factory.METHODS, true, result, errors); result = unmodifiableSet(result); if (errors.hasErrors()) { throw new ConfigurationException(errors.getMessages()).withPartialValue(result); } return result; }
/** * Returns all instance method and field injection points on {@code type}. * * @return a possibly empty set of injection points. The set has a specified iteration order. All * fields are returned and then all methods. Within the fields, supertype fields are returned * before subtype fields. Similarly, supertype methods are returned before subtype methods. * @throws ConfigurationException if there is a malformed injection point on {@code type}, such as * a field with multiple binding annotations. The exception's {@link * ConfigurationException#getPartialValue() partial value} is a {@code Set<InjectionPoint>} * of the valid injection points. */ public static Set<InjectionPoint> forInstanceMethodsAndFields(TypeLiteral<?> type) { Set<InjectionPoint> result = new HashSet<>(); Errors errors = new Errors(); // TODO (crazybob): Filter out overridden members. addInjectionPoints(type, Factory.FIELDS, false, result, errors); addInjectionPoints(type, Factory.METHODS, false, result, errors); result = unmodifiableSet(result); if (errors.hasErrors()) { throw new ConfigurationException(errors.getMessages()).withPartialValue(result); } return result; }
private static <M extends Member & AnnotatedElement> void addInjectionPoints(TypeLiteral<?> type, Factory<M> factory, boolean statics, Collection<InjectionPoint> injectionPoints, Errors errors) { if (type.getType() == Object.class) { return; } // Add injectors for superclass first. TypeLiteral<?> superType = type.getSupertype(type.getRawType().getSuperclass()); addInjectionPoints(superType, factory, statics, injectionPoints, errors); // Add injectors for all members next addInjectorsForMembers(type, factory, statics, injectionPoints, errors); }
/** * Returns all static method and field injection points on {@code type}. * * @return a possibly empty set of injection points. The set has a specified iteration order. All * fields are returned and then all methods. Within the fields, supertype fields are returned * before subtype fields. Similarly, supertype methods are returned before subtype methods. * @throws ConfigurationException if there is a malformed injection point on {@code type}, such as * a field with multiple binding annotations. The exception's {@link * ConfigurationException#getPartialValue() partial value} is a {@code Set<InjectionPoint>} * of the valid injection points. */ public static Set<InjectionPoint> forStaticMethodsAndFields(TypeLiteral type) { Set<InjectionPoint> result = new HashSet<>(); Errors errors = new Errors(); addInjectionPoints(type, Factory.FIELDS, true, result, errors); addInjectionPoints(type, Factory.METHODS, true, result, errors); result = unmodifiableSet(result); if (errors.hasErrors()) { throw new ConfigurationException(errors.getMessages()).withPartialValue(result); } return result; }
/** * Returns all instance method and field injection points on {@code type}. * * @return a possibly empty set of injection points. The set has a specified iteration order. All * fields are returned and then all methods. Within the fields, supertype fields are returned * before subtype fields. Similarly, supertype methods are returned before subtype methods. * @throws ConfigurationException if there is a malformed injection point on {@code type}, such as * a field with multiple binding annotations. The exception's {@link * ConfigurationException#getPartialValue() partial value} is a {@code Set<InjectionPoint>} * of the valid injection points. */ public static Set<InjectionPoint> forInstanceMethodsAndFields(TypeLiteral<?> type) { Set<InjectionPoint> result = new HashSet<>(); Errors errors = new Errors(); // TODO (crazybob): Filter out overridden members. addInjectionPoints(type, Factory.FIELDS, false, result, errors); addInjectionPoints(type, Factory.METHODS, false, result, errors); result = unmodifiableSet(result); if (errors.hasErrors()) { throw new ConfigurationException(errors.getMessages()).withPartialValue(result); } return result; }
private static <M extends Member & AnnotatedElement> void addInjectionPoints(TypeLiteral<?> type, Factory<M> factory, boolean statics, Collection<InjectionPoint> injectionPoints, Errors errors) { if (type.getType() == Object.class) { return; } // Add injectors for superclass first. TypeLiteral<?> superType = type.getSupertype(type.getRawType().getSuperclass()); addInjectionPoints(superType, factory, statics, injectionPoints, errors); // Add injectors for all members next addInjectorsForMembers(type, factory, statics, injectionPoints, errors); }
/** * Returns all instance method and field injection points on {@code type}. * * @return a possibly empty set of injection points. The set has a specified iteration order. All * fields are returned and then all methods. Within the fields, supertype fields are returned * before subtype fields. Similarly, supertype methods are returned before subtype methods. * @throws ConfigurationException if there is a malformed injection point on {@code type}, such as * a field with multiple binding annotations. The exception's {@link * ConfigurationException#getPartialValue() partial value} is a {@code Set<InjectionPoint>} * of the valid injection points. */ public static Set<InjectionPoint> forInstanceMethodsAndFields(TypeLiteral<?> type) { Set<InjectionPoint> result = new HashSet<>(); Errors errors = new Errors(); // TODO (crazybob): Filter out overridden members. addInjectionPoints(type, Factory.FIELDS, false, result, errors); addInjectionPoints(type, Factory.METHODS, false, result, errors); result = unmodifiableSet(result); if (errors.hasErrors()) { throw new ConfigurationException(errors.getMessages()).withPartialValue(result); } return result; }
private static <M extends Member & AnnotatedElement> void addInjectionPoints(TypeLiteral<?> type, Factory<M> factory, boolean statics, Collection<InjectionPoint> injectionPoints, Errors errors) { if (type.getType() == Object.class) { return; } // Add injectors for superclass first. TypeLiteral<?> superType = type.getSupertype(type.getRawType().getSuperclass()); addInjectionPoints(superType, factory, statics, injectionPoints, errors); // Add injectors for all members next addInjectorsForMembers(type, factory, statics, injectionPoints, errors); }
private static <M extends Member & AnnotatedElement> void addInjectionPoints(TypeLiteral<?> type, Factory<M> factory, boolean statics, Collection<InjectionPoint> injectionPoints, Errors errors) { if (type.getType() == Object.class) { return; } // Add injectors for superclass first. TypeLiteral<?> superType = type.getSupertype(type.getRawType().getSuperclass()); addInjectionPoints(superType, factory, statics, injectionPoints, errors); // Add injectors for all members next addInjectorsForMembers(type, factory, statics, injectionPoints, errors); }
/** * Returns all instance method and field injection points on {@code type}. * * @return a possibly empty set of injection points. The set has a specified iteration order. All * fields are returned and then all methods. Within the fields, supertype fields are returned * before subtype fields. Similarly, supertype methods are returned before subtype methods. * @throws ConfigurationException if there is a malformed injection point on {@code type}, such as * a field with multiple binding annotations. The exception's {@link * ConfigurationException#getPartialValue() partial value} is a {@code Set<InjectionPoint>} * of the valid injection points. */ public static Set<InjectionPoint> forInstanceMethodsAndFields(TypeLiteral<?> type) { List<InjectionPoint> sink = new ArrayList<>(); Errors errors = new Errors(); // TODO (crazybob): Filter out overridden members. addInjectionPoints(type, Factory.FIELDS, false, sink, errors); addInjectionPoints(type, Factory.METHODS, false, sink, errors); ImmutableSet<InjectionPoint> result = ImmutableSet.copyOf(sink); if (errors.hasErrors()) { throw new ConfigurationException(errors.getMessages()).withPartialValue(result); } return result; }
/** * Returns all static method and field injection points on {@code type}. * * @return a possibly empty set of injection points. The set has a specified iteration order. All * fields are returned and then all methods. Within the fields, supertype fields are returned * before subtype fields. Similarly, supertype methods are returned before subtype methods. * @throws ConfigurationException if there is a malformed injection point on {@code type}, such as * a field with multiple binding annotations. The exception's {@link * ConfigurationException#getPartialValue() partial value} is a {@code Set<InjectionPoint>} * of the valid injection points. */ public static Set<InjectionPoint> forStaticMethodsAndFields(TypeLiteral type) { List<InjectionPoint> sink = new ArrayList<>(); Errors errors = new Errors(); addInjectionPoints(type, Factory.FIELDS, true, sink, errors); addInjectionPoints(type, Factory.METHODS, true, sink, errors); ImmutableSet<InjectionPoint> result = ImmutableSet.copyOf(sink); if (errors.hasErrors()) { throw new ConfigurationException(errors.getMessages()).withPartialValue(result); } return result; }