Interface InjectorFactory
- All Known Implementing Classes:
CdiInjectorFactory, InjectorFactoryImpl
public interface InjectorFactory
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Method Summary
Modifier and TypeMethodDescriptiondefault ConstructorInjectorcreateConstructor(Class<?> clazz, ResteasyProviderFactory providerFactory) Attempts to create a constructor injector for a class without pre-selecting a constructor.createConstructor(Constructor constructor, ResteasyProviderFactory factory) createConstructor(ResourceConstructor constructor, ResteasyProviderFactory providerFactory) createMethodInjector(ResourceLocator method, ResteasyProviderFactory factory) createParameterExtractor(Class injectTargetClass, AccessibleObject injectTarget, String defaultName, Class type, Type genericType, Annotation[] annotations, boolean useDefault, ResteasyProviderFactory factory) createParameterExtractor(Class injectTargetClass, AccessibleObject injectTarget, String defaultName, Class type, Type genericType, Annotation[] annotations, ResteasyProviderFactory factory) createParameterExtractor(Parameter parameter, ResteasyProviderFactory providerFactory) createPropertyInjector(Class resourceClass, ResteasyProviderFactory factory) createPropertyInjector(ResourceClass resourceClass, ResteasyProviderFactory providerFactory) default <T> Class<? super T> resolveType(Class<T> type) Returns the type a container proxy class delegates to, e.g. the bean class of a CDI client proxy class.default ObjectunwrapProxy(Object instance) Returns the instance a container proxy delegates to.
-
Method Details
-
createConstructor
default ConstructorInjector createConstructor(Class<?> clazz, ResteasyProviderFactory providerFactory) Attempts to create a constructor injector for a class without pre-selecting a constructor. This allows injector factories (such as CDI) to handle classes that may not have public constructors.The default implementation uses
PickConstructor.pickSingletonConstructor(Class)to selecta constructor and delegates tocreateConstructor(Constructor, ResteasyProviderFactory). Implementations can override this to provide custom constructor selection logic.- Parameters:
clazz- the class to create a constructor injector forproviderFactory- the provider factory- Returns:
- a constructor injector, or
nullif no suitable constructor can be found
-
createConstructor
-
createPropertyInjector
-
createParameterExtractor
ValueInjector createParameterExtractor(Class injectTargetClass, AccessibleObject injectTarget, String defaultName, Class type, Type genericType, Annotation[] annotations, ResteasyProviderFactory factory) -
createParameterExtractor
ValueInjector createParameterExtractor(Class injectTargetClass, AccessibleObject injectTarget, String defaultName, Class type, Type genericType, Annotation[] annotations, boolean useDefault, ResteasyProviderFactory factory) -
createParameterExtractor
ValueInjector createParameterExtractor(Parameter parameter, ResteasyProviderFactory providerFactory) -
createMethodInjector
-
createPropertyInjector
PropertyInjector createPropertyInjector(ResourceClass resourceClass, ResteasyProviderFactory providerFactory) -
createConstructor
ConstructorInjector createConstructor(ResourceConstructor constructor, ResteasyProviderFactory providerFactory) -
unwrapProxy
Returns the instance a container proxy delegates to. If the instance is not a proxy, it is returned as is.The container may create the instance when this is invoked, e.g. for a CDI client proxy of a normal scoped bean.
The default implementation returns the instance.
- Parameters:
instance- the instance, which may be a container proxy- Returns:
- the instance behind the proxy, or the instance if it is not a container proxy
- Since:
- 8.0
-
resolveType
Returns the type a container proxy class delegates to, e.g. the bean class of a CDI client proxy class. This does not create the instance behind the proxy. If the type is not a proxy class, it is returned as is.The default implementation resolves synthetic proxy classes, e.g. CDI client proxies and intercepted subclasses, to their superclass. Other types are returned as is. Implementations for containers which do not mark proxy classes as synthetic should override this.
- Type Parameters:
T- the type- Parameters:
type- the type, which may be a container proxy class- Returns:
- the type the proxy class delegates to, or the type if it is not a proxy class
- Since:
- 8.0
-