code: private boolean isNullOrMatchingType(final Object injectedValue, final Field field) {
  
          if (injectedValue == null) {
              // null is always type-compatible
              return true;
          }
  
          final Class<?> fieldType = field.getType();
          final Class<?> valueType = injectedValue.getClass();
  
          if (fieldType.isPrimitive()) {
              return fieldType == primitiveTypeFor(valueType);
          }
          return fieldType.isAssignableFrom(valueType);
      }
docs: Checks if the specified value is either null or compatible with the field. Compatibility is verified based
  on inheritance or primitive-type compatibility.
  @param injectedValue
  the value that is checked against the field
  @param field
  the field that should be compatible with the value
  @return
  <code>true</code> if the value is compatible with the field