@Override
@SuppressWarnings("unchecked")
public <T> Parameter<T> getParameter(int position, Class<T> type) {
checkOpen( false );
Parameter param = findParameterRegistration( position );
if ( param.getParameterType() != null ) {
// we were able to determine the expected type during analysis, so validate it here
if ( ! param.getParameterType().isAssignableFrom( type ) ) {
throw new IllegalArgumentException(
String.format(
"Parameter type [%s] is not assignment compatible with requested type [%s] for parameter at position [%s]",
param.getParameterType().getName(),
type.getName(),
position
)
);
}