/** * This method returns the class associated with the type of the * factory * * @param factoryClass The non-null factory class. May not be null * @return the CLASS version of what the factory produces. Will * not be null * @throws MultiException if there was an error analyzing the class */ private static Class<?> getFactoryProductionClass(Class<?> factoryClass) { Type factoryProvidedType = getFactoryProductionType(factoryClass); Class<?> retVal = ReflectionHelper.getRawClass(factoryProvidedType); if (retVal != null) return retVal; throw new MultiException(new AssertionError("Could not find true produced type of factory " + factoryClass.getName())); }
/** * This method returns the class associated with the type of the * factory * * @param factoryClass The non-null factory class. May not be null * @return the CLASS version of what the factory produces. Will * not be null * @throws MultiException if there was an error analyzing the class */ private static Class<?> getFactoryProductionClass(Class<?> factoryClass) { Type factoryProvidedType = getFactoryProductionType(factoryClass); Class<?> retVal = ReflectionHelper.getRawClass(factoryProvidedType); if (retVal != null) return retVal; throw new MultiException(new AssertionError("Could not find true produced type of factory " + factoryClass.getName())); }
/** * This method returns the class associated with the type of the * factory * * @param factoryClass The non-null factory class. May not be null * @return the CLASS version of what the factory produces. Will * not be null * @throws MultiException if there was an error analyzing the class */ private static Class<?> getFactoryProductionClass(Class<?> factoryClass) { Type factoryProvidedType = getFactoryProductionType(factoryClass); Class<?> retVal = ReflectionHelper.getRawClass(factoryProvidedType); if (retVal != null) return retVal; throw new MultiException(new AssertionError("Could not find true produced type of factory " + factoryClass.getName())); }
/** * This method returns the class associated with the type of the factory. * * @param descriptor The descriptor (reified and not null) that will be used to find the implementation. * @return the CLASS version of what the factory produces. Will not be null. * @throws MultiException if there was an error analyzing the class. */ private static Class<?> getFactoryProductionClass(ActiveDescriptor<?> descriptor) { Class<?> factoryClass = descriptor.getImplementationClass(); Type factoryProvidedType = getFactoryProductionType(factoryClass); Class<?> retVal = ReflectionHelper.getRawClass(factoryProvidedType); if (retVal == null && descriptor.getContractTypes().size() == 1) { // If the type was not resolved from a generic type, try to use // contract type if only one was registered. Type contract = descriptor.getContractTypes().iterator().next(); retVal = ReflectionHelper.getRawClass(contract); } if (retVal == null) { throw new MultiException(new AssertionError("Could not find true produced type of factory " + factoryClass.getName())); } return retVal; }
factoryProvidedType = Utilities.getFactoryProductionType(implClass);
factoryProvidedType = Utilities.getFactoryProductionType(implClass);
factoryProvidedType = Utilities.getFactoryProductionType(implClass);
factoryProvidedType = Utilities.getFactoryProductionType(implClass);
Type factoryProductionType = Utilities.getFactoryProductionType(parentClazz);
Type factoryProductionType = Utilities.getFactoryProductionType(parentClazz);
Type factoryProductionType = Utilities.getFactoryProductionType(parentClazz);
Type factoryProductionType = Utilities.getFactoryProductionType(parentClazz);