@Override @SuppressWarnings("unchecked") public <T> Class<T> classForName(String name) { try { return (Class<T>) getClass().getClassLoader().loadClass( name ); } catch (ClassNotFoundException e) { throw new ClassLoadingException( "Could not load class by name : " + name, e ); } }
@Override @SuppressWarnings({"unchecked"}) public <T> Class<T> classForName(String className) { try { return (Class<T>) Class.forName( className, true, getAggregatedClassLoader() ); } catch (Exception e) { throw new ClassLoadingException( "Unable to load class [" + className + "]", e ); } catch (LinkageError e) { throw new ClassLoadingException( "Unable to load class [" + className + "]", e ); } }
/** * Locate class with a given name. * * @param name Fully qualified class name. * @param classLoaderService Class loading service. Passing {@code null} is "allowed", but will result in * TCCL usage. * * @return The cass reference. * * @throws ClassLoadingException Indicates the class could not be found. */ @SuppressWarnings("unchecked") public static <T> Class<T> loadClass(String name, ClassLoaderService classLoaderService) throws ClassLoadingException { try { if ( classLoaderService != null ) { return classLoaderService.classForName( name ); } else { return (Class<T>) Thread.currentThread().getContextClassLoader().loadClass( name ); } } catch (Exception e) { throw new ClassLoadingException( "Unable to load class [" + name + "]", e ); } } }
throw new ClassLoadingException( name );
throw new ClassLoadingException( LOG.jdbcDriverNotFound( jdbcDriverClass ), e );
@Override @SuppressWarnings({"unchecked"}) public <T> Class<T> classForName(String className) { try { return (Class<T>) Class.forName( className, true, getAggregatedClassLoader() ); } catch (Exception e) { throw new ClassLoadingException( "Unable to load class [" + className + "]", e ); } catch (LinkageError e) { throw new ClassLoadingException( "Unable to load class [" + className + "]", e ); } }
/** * Locate class with a given name. * * @param name Fully qualified class name. * @param classLoaderService Class loading service. Passing {@code null} is "allowed", but will result in * TCCL usage. * * @return The cass reference. * * @throws ClassLoadingException Indicates the class could not be found. */ @SuppressWarnings("unchecked") public static <T> Class<T> loadClass(String name, ClassLoaderService classLoaderService) throws ClassLoadingException { try { if ( classLoaderService != null ) { return classLoaderService.classForName( name ); } else { return (Class<T>) Thread.currentThread().getContextClassLoader().loadClass( name ); } } catch (Exception e) { throw new ClassLoadingException( "Unable to load class [" + name + "]", e ); } } }
throw new ClassLoadingException( name );
throw new ClassLoadingException( LOG.jdbcDriverNotFound( jdbcDriverClass ), e );
.andThrow( new ClassLoadingException( "Called by JavaTimeBridgeProvider; we assume the classes in java.time are not on the ORM class loader" ) ) .anyTimes();