/** * This method returns the type produced by a factory class * * @param factoryClass The non-null factory class. May not be null * @return the type version of what the factory produces. Will * not be null * @throws MultiException if there was an error analyzing the class */ public static Type getFactoryProductionType(Class<?> factoryClass) { Set<Type> factoryTypes = ReflectionHelper.getTypeClosure(factoryClass, Collections.singleton(Factory.class.getName())); ParameterizedType parameterizedType = (ParameterizedType) factoryTypes.iterator().next(); Type factoryProvidedType = parameterizedType.getActualTypeArguments()[0]; return factoryProvidedType; }
/** * This method returns the type produced by a factory class * * @param factoryClass The non-null factory class. May not be null * @return the type version of what the factory produces. Will * not be null * @throws MultiException if there was an error analyzing the class */ public static Type getFactoryProductionType(Class<?> factoryClass) { Set<Type> factoryTypes = ReflectionHelper.getTypeClosure(factoryClass, Collections.singleton(Factory.class.getName())); ParameterizedType parameterizedType = (ParameterizedType) factoryTypes.iterator().next(); Type factoryProvidedType = parameterizedType.getActualTypeArguments()[0]; return factoryProvidedType; }
/** * This method returns the type produced by a factory class * * @param factoryClass The non-null factory class. May not be null * @return the type version of what the factory produces. Will * not be null * @throws MultiException if there was an error analyzing the class */ public static Type getFactoryProductionType(Class<?> factoryClass) { Set<Type> factoryTypes = ReflectionHelper.getTypeClosure(factoryClass, Collections.singleton(Factory.class.getName())); ParameterizedType parameterizedType = (ParameterizedType) factoryTypes.iterator().next(); Type factoryProvidedType = parameterizedType.getActualTypeArguments()[0]; return factoryProvidedType; }
/** * This method returns the type produced by a factory class * * @param factoryClass The non-null factory class. May not be null * @return the type version of what the factory produces. Will * not be null * @throws MultiException if there was an error analyzing the class */ public static Type getFactoryProductionType(Class<?> factoryClass) { Set<Type> factoryTypes = ReflectionHelper.getTypeClosure(factoryClass, Collections.singleton(Factory.class.getName())); ParameterizedType parameterizedType = (ParameterizedType) factoryTypes.iterator().next(); Type factoryProvidedType = parameterizedType.getActualTypeArguments()[0]; return factoryProvidedType; }
/** * Returns the type closure, as restricted by the classes listed in the * set of contracts implemented * * @param ofType The type to check * @param contracts The contracts this type is allowed to handle * @return The type closure restricted to the contracts */ public static Set<Type> getTypeClosure(Type ofType, Set<String> contracts) { Set<Type> closure = getTypeClosure(ofType); HashSet<Type> retVal = new HashSet<Type>(); for (Type t : closure) { Class<?> rawClass = ReflectionHelper.getRawClass(t); if (rawClass == null) continue; if (contracts.contains(rawClass.getName())) { retVal.add(t); } } return retVal; }
/** * Returns the type closure, as restricted by the classes listed in the * set of contracts implemented * * @param ofType The type to check * @param contracts The contracts this type is allowed to handle * @return The type closure restricted to the contracts */ public static Set<Type> getTypeClosure(Type ofType, Set<String> contracts) { Set<Type> closure = getTypeClosure(ofType); HashSet<Type> retVal = new HashSet<Type>(); for (Type t : closure) { Class<?> rawClass = ReflectionHelper.getRawClass(t); if (rawClass == null) continue; if (contracts.contains(rawClass.getName())) { retVal.add(t); } } return retVal; }
/** * Returns the type closure, as restricted by the classes listed in the * set of contracts implemented * * @param ofType The type to check * @param contracts The contracts this type is allowed to handle * @return The type closure restricted to the contracts */ public static Set<Type> getTypeClosure(Type ofType, Set<String> contracts) { Set<Type> closure = getTypeClosure(ofType); HashSet<Type> retVal = new HashSet<Type>(); for (Type t : closure) { Class<?> rawClass = ReflectionHelper.getRawClass(t); if (rawClass == null) continue; if (contracts.contains(rawClass.getName())) { retVal.add(t); } } return retVal; }
/** * Returns the type closure, as restricted by the classes listed in the * set of contracts implemented * * @param ofType The type to check * @param contracts The contracts this type is allowed to handle * @return The type closure restricted to the contracts */ public static Set<Type> getTypeClosure(Type ofType, Set<String> contracts) { Set<Type> closure = getTypeClosure(ofType); HashSet<Type> retVal = new HashSet<Type>(); for (Type t : closure) { Class<?> rawClass = ReflectionHelper.getRawClass(t); if (rawClass == null) continue; if (contracts.contains(rawClass.getName())) { retVal.add(t); } } return retVal; }
scope = si.getAnnoType(); contracts = Collections.unmodifiableSet(ReflectionHelper.getTypeClosure(implClass, baseDescriptor.getAdvertisedContracts())); scope = si.getAnnoType(); contracts = Collections.unmodifiableSet(ReflectionHelper.getTypeClosure( factoryProvidedType, baseDescriptor.getAdvertisedContracts()));
scope = si.getAnnoType(); contracts = Collections.unmodifiableSet(ReflectionHelper.getTypeClosure(implClass, baseDescriptor.getAdvertisedContracts())); scope = si.getAnnoType(); contracts = Collections.unmodifiableSet(ReflectionHelper.getTypeClosure( factoryProvidedType, baseDescriptor.getAdvertisedContracts()));
scope = si.getAnnoType(); contracts = Collections.unmodifiableSet(ReflectionHelper.getTypeClosure(implClass, baseDescriptor.getAdvertisedContracts())); scope = si.getAnnoType(); contracts = Collections.unmodifiableSet(ReflectionHelper.getTypeClosure( factoryProvidedType, baseDescriptor.getAdvertisedContracts()));
scope = si.getAnnoType(); contracts = Collections.unmodifiableSet(ReflectionHelper.getTypeClosure(implClass, baseDescriptor.getAdvertisedContracts())); scope = si.getAnnoType(); contracts = Collections.unmodifiableSet(ReflectionHelper.getTypeClosure( factoryProvidedType, baseDescriptor.getAdvertisedContracts()));