private void checkAssignability(Class parameter, Class declared) throws MBeanException {
    Logger logger = getLogger();

    if (logger.isEnabledFor(Logger.DEBUG)) {
      logger.debug("The class of the parameter is: " + parameter);
      if (parameter != null) {
        logger.debug("The classloder of the parameter's class is: " + parameter.getClassLoader());
      }
      logger.debug("The class declared as type of the attribute is: " + declared);
      if (declared != null) {
        logger.debug(
            "The classloader of the declared parameter's class is: " + declared.getClassLoader());
      }
    }

    boolean assignable = false;

    if (declared == null || parameter == null) {
      assignable = false;
    } else if (declared == boolean.class && parameter == Boolean.class) {
      assignable = true;
    } else if (declared == byte.class && parameter == Byte.class) {
      assignable = true;
    } else if (declared == char.class && parameter == Character.class) {
      assignable = true;
    } else if (declared == short.class && parameter == Short.class) {
      assignable = true;
    } else if (declared == int.class && parameter == Integer.class) {
      assignable = true;
    } else if (declared == long.class && parameter == Long.class) {
      assignable = true;
    } else if (declared == float.class && parameter == Float.class) {
      assignable = true;
    } else if (declared == double.class && parameter == Double.class) {
      assignable = true;
    } else {
      assignable = declared.isAssignableFrom(parameter);
    }

    if (!assignable) {
      if (logger.isEnabledFor(Logger.TRACE)) {
        logger.trace(
            "Parameter value's class and attribute's declared return class are not assignable");
      }
      throw new MBeanException(new InvalidAttributeValueException(
          "Returned type and declared type are not assignable."));
    }
  }
@author <a href="mailto:biorn_steedom@users.sourceforge.net">Simone Bordet</a>
@version $Revision: 1.14 $
geode-core/src/main/java/org/apache/geode/admin/jmx/internal/MX4JModelMBean.java