X
- the declaring typepublic class InjectableMethod<X> extends Object
Allows an AnnotatedMethod
to be injected using the CDI type safe
resolution rules.
ParameterValueRedefiner
allows the default value to be overridden by
the caller of
invoke(Object, CreationalContext, ParameterValueRedefiner)
.
Constructor and Description |
---|
InjectableMethod(javax.enterprise.inject.spi.AnnotatedMethod<X> method,
javax.enterprise.inject.spi.Bean<?> declaringBean,
javax.enterprise.inject.spi.BeanManager beanManager)
Instantiate a new
InjectableMethod . |
InjectableMethod(javax.enterprise.inject.spi.AnnotatedMethod<X> method,
Collection<javax.enterprise.inject.spi.InjectionPoint> parameters,
javax.enterprise.inject.spi.BeanManager beanManager)
Instantiate a new
InjectableMethod . |
Modifier and Type | Method and Description |
---|---|
protected javax.enterprise.inject.spi.BeanManager |
getBeanManager()
Get the bean manager used by this injectable method.
|
protected List<javax.enterprise.inject.spi.InjectionPoint> |
getParameters()
Get the injectable parameters of this method.
|
<T> T |
invoke(Object receiver,
javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Invoke the method, causing all parameters to be injected according to the
CDI type safe resolution rules.public class ParameterValueRedefiner {
}
|
<T> T |
invoke(Object receiver,
javax.enterprise.context.spi.CreationalContext<T> creationalContext,
ParameterValueRedefiner redefinition)
Invoke the method, calling the parameter redefiner for each parameter,
allowing the caller to override the default value obtained via the CDI
type safe resolver.
|
public InjectableMethod(javax.enterprise.inject.spi.AnnotatedMethod<X> method, javax.enterprise.inject.spi.Bean<?> declaringBean, javax.enterprise.inject.spi.BeanManager beanManager)
InjectableMethod
.method
- the method which will be injected upon a call to
invoke(Object, CreationalContext)
declaringBean
- the bean which defines the injectable methodbeanManager
- the BeanManager
to use to obtain the parameter valuespublic InjectableMethod(javax.enterprise.inject.spi.AnnotatedMethod<X> method, Collection<javax.enterprise.inject.spi.InjectionPoint> parameters, javax.enterprise.inject.spi.BeanManager beanManager)
InjectableMethod
.method
- the method which will be injected upon a call to
invoke(Object, CreationalContext)
parameters
- a collection of injection points representing the
parameters of the methodbeanManager
- the BeanManager
to use to obtain the parameter
valuesprotected javax.enterprise.inject.spi.BeanManager getBeanManager()
protected List<javax.enterprise.inject.spi.InjectionPoint> getParameters()
public <T> T invoke(Object receiver, javax.enterprise.context.spi.CreationalContext<T> creationalContext) throws IllegalAccessException, IllegalArgumentException
T
- the return type of the methodreceiver
- the instance upon which to call the methodcreationalContext
- the creational context to use to obtain
injectable references for each parameterRuntimeException
- if this Method
object enforces Java
language access control and the underlying method is
inaccessible or if the underlying method throws an exception or
if the initialization provoked by this method fails.IllegalArgumentException
- if the method is an instance method and
the specified receiver
argument is not an instance
of the class or interface declaring the underlying method (or
of a subclass or implementor thereof); if an unwrapping
conversion for primitive arguments fails; or if, after possible
unwrapping, a parameter value cannot be converted to the
corresponding formal parameter type by a method invocation
conversion.NullPointerException
- if the specified receiver
is
null and the method is an instance method.ExceptionInInitializerError
- if the initialization provoked by this
method fails.IllegalAccessException
public <T> T invoke(Object receiver, javax.enterprise.context.spi.CreationalContext<T> creationalContext, ParameterValueRedefiner redefinition) throws IllegalAccessException, IllegalArgumentException
T
- the return type of the methodreceiver
- the instance upon which to call the methodcreationalContext
- the creational context to use to obtain
injectable references for each parameterRuntimeException
- if this Method
object enforces Java
language access control and the underlying method is
inaccessible or if the underlying method throws an exception or
if the initialization provoked by this method fails.IllegalArgumentException
- if the method is an instance method and
the specified receiver
argument is not an instance
of the class or interface declaring the underlying method (or
of a subclass or implementor thereof); if an unwrapping
conversion for primitive arguments fails; or if, after possible
unwrapping, a parameter value cannot be converted to the
corresponding formal parameter type by a method invocation
conversion.NullPointerException
- if the specified receiver
is
null and the method is an instance method.ExceptionInInitializerError
- if the initialization provoked by this
method fails.IllegalAccessException
Copyright © 2020 The Apache Software Foundation. All rights reserved.