code: static boolean onClasspath(String className) {
          ClassLoader cl = Thread.currentThread().getContextClassLoader();
          try {
              cl.loadClass(className);
          } catch (ClassNotFoundException e) {
              return false;
          }
          return true;
      }
docs: Checks to see if JSR303 implementation is
  available on classpath.