if ( methodDeclaration.getParameters().size() != 1 ) {
throw new IllegalArgumentException( "Expected one parameter. But was <" + methodDeclaration.getParameters() + ">" );
}
ParameterDeclaration parameterDeclaration = methodDeclaration.getParameters().iterator().next();
if ( !TypeUtils.isAssignable( type, parameterDeclaration.getType() ) ) {
throw new IllegalArgumentException( "Invalid parameter type for <" + expectedName + ">. Was <" + parameterDeclaration.getType() + "> but expected <" + type + ">" );
}
return methodDeclaration;
}