コード例 #1
0
  private boolean isAssignableFrom(Store store, String className) throws ClassNotFoundException {

    Class<? extends Store> storeClass = store.getClass();

    ClassLoader classLoader = storeClass.getClassLoader();

    Class<?> clazz = classLoader.loadClass(className);

    return clazz.isAssignableFrom(storeClass);
  }
コード例 #2
0
  protected int getDelegatorStoresCount(Store store) throws Exception {
    try {
      Class<? extends Store> storeClass = store.getClass();

      Method method = storeClass.getMethod("getDelegatorStoresCount");

      return (Integer) method.invoke(store);
    } catch (NoSuchMethodException nsme) {
      throw new IllegalArgumentException(
          ClassUtil.getClassName(store) + " does not implement DelegatorStore", nsme);
    }
  }