public static boolean isClassesCompatible ( Class < ? > memberClass , Class < ? > injectClass ) { // If the class of the field or method is the injection // type or a parent of it, then the injection may occur. d433391 if ( memberClass . isAssignableFrom ( injectClass ) ) return true ; // TODO : Remove this hack when EJB injection is working properly // Currently for EJB injection from XML, the 'member' class is // is always set to 'Object'. d433391 if ( injectClass . isAssignableFrom ( memberClass ) ) return true ; // Otherwise, check to see if either is a primitive, and if so, // verify that the types are compatible. // TODO : this needs to handle where the primitive types are different // but may still be compatible... or one is an Object that // may be autoboxed to a primitive ..like Integer -> short return getPrimitiveClass ( memberClass ) == getPrimitiveClass ( injectClass ) ; }
Test if the input two classes are auto - boxing compatible .