public static Class < ? > getTypeForProperty ( Method getter ) { Class < ? > returnType = getter . getReturnType ( ) ; if ( returnType . equals ( Void . TYPE ) ) throw new IllegalArgumentException ( "Getter " + getter . toString ( ) + " does not have a returntype." ) ; else if ( returnType . isPrimitive ( ) ) return MethodUtils . getPrimitiveWrapper ( returnType ) ; return returnType ; }
Returns the type of the property checking if it actually does return something and wrapping primitives if needed .