private boolean isBoxingMethod ( ExecutableElement method ) { TypeElement declaringClass = ElementUtil . getDeclaringClass ( method ) ; // Autoboxing methods. if ( typeUtil . isBoxedType ( declaringClass . asType ( ) ) ) { String name = ElementUtil . getName ( method ) ; TypeMirror returnType = method . getReturnType ( ) ; List < ? extends VariableElement > params = method . getParameters ( ) ; if ( name . equals ( "valueOf" ) && params . size ( ) == 1 && params . get ( 0 ) . asType ( ) . getKind ( ) . isPrimitive ( ) ) { return true ; } if ( params . isEmpty ( ) && returnType . getKind ( ) . isPrimitive ( ) && name . equals ( TypeUtil . getName ( returnType ) + "Value" ) ) { return true ; } } return false ; }
Checks if the given method is a primitive boxing or unboxing method .