public final class Loader extends java.lang.Object implements java.util.function.Function<java.lang.String,java.lang.Class<?>>
Loader just encapsulate a ClassLoader. The class implements
 java.util.function.Function<String, Class<?>> so that a loader can be directly mapped to a stream of the
 names of the classes to load. Moreover, the ClassNotFoundException is catched to return
 null, allowing a more "flowing" use. For instance:
 
 Loader loader = Loader.forObject(this);
 Stream.of("java.lang.String", "gololang.Tuple", "foo.bar.Baz", "java.util.LinkedList")
     .map(loader)
     .filter(java.util.Objects::nonNull)
     .map(klass -> dealWithTheClass(klass))
 | Modifier and Type | Method and Description | 
|---|---|
java.lang.Class<?> | 
apply(java.lang.String name)
Just delegate to  
load(java.lang.String) to implement Function. | 
static Loader | 
forClass(java.lang.Class<?> klass)
Create a loader using the  
ClassLoader of the given class | 
static Loader | 
forClassLoader(java.lang.ClassLoader loader)  | 
static Loader | 
forCurrentThread()
Create a loader using the  
ClassLoader of the current thread. | 
java.lang.Class<?> | 
load(java.lang.String name)
Load the given class. 
 | 
public static Loader forClassLoader(java.lang.ClassLoader loader)
public static Loader forCurrentThread()
ClassLoader of the current thread.Loaderpublic static Loader forClass(java.lang.Class<?> klass)
ClassLoader of the given classklass - the class whose ClassLoader to useLoaderpublic java.lang.Class<?> load(java.lang.String name)
 This only delegates to the underlying class loader, but returns null instead
 of throwing a ClassNotFoundException exception.
null otherwise.public java.lang.Class<?> apply(java.lang.String name)
load(java.lang.String) to implement Function.apply in interface java.util.function.Function<java.lang.String,java.lang.Class<?>>load(java.lang.String)