public < T > T invoke ( Object receiver , CreationalContext < T > creationalContext , ParameterValueRedefiner redefinition ) { List < Object > parameterValues = new ArrayList < Object > ( ) ; for ( int i = 0 ; i < getParameters ( ) . size ( ) ; i ++ ) { if ( redefinition != null ) { ParameterValueRedefiner . ParameterValue value = new ParameterValueRedefiner . ParameterValue ( i , getParameters ( ) . get ( i ) , getBeanManager ( ) ) ; parameterValues . add ( redefinition . redefineParameterValue ( value ) ) ; } else { parameterValues . add ( getBeanManager ( ) . getInjectableReference ( getParameters ( ) . get ( i ) , creationalContext ) ) ; } } @ SuppressWarnings ( "unchecked" ) T result = ( T ) Reflections . invokeMethod ( true , method . getJavaMember ( ) , receiver , parameterValues . toArray ( Reflections . EMPTY_OBJECT_ARRAY ) ) ; return result ; }
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 .