Package org.eclipse.sisu.wire
Class GlueLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- org.eclipse.sisu.wire.GlueLoader
-
final class GlueLoader extends java.lang.ClassLoaderWeak cache ofClassLoaders that can generate proxy classes on-demand.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.concurrent.ConcurrentMap<java.lang.Integer,GlueLoader>cachedGlueprivate static java.lang.StringDYNAMICprivate static java.lang.StringGLUE_SUFFIXprivate static java.lang.StringPROVIDER_NAMEprivate static java.lang.ObjectSYSTEM_LOADER_LOCK
-
Constructor Summary
Constructors Constructor Description GlueLoader()GlueLoader(java.lang.ClassLoader parent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static GlueLoadercreateGlue(java.lang.ClassLoader parent)Returns newGlueLoaderthat delegates to the givenClassLoader.static <T> TdynamicGlue(com.google.inject.TypeLiteral<T> type, javax.inject.Provider<T> provider)Generates a new dynamic proxy instance for the given facade type and provider.private static java.lang.Class<?>dynamicGlue(java.lang.Class<?> facade)Loads the dynamic proxy class for the given facade class.protected java.lang.Class<?>findClass(java.lang.String name)private static GlueLoaderglue(java.lang.ClassLoader parent)Returns theGlueLoaderassociated with the givenClassLoader.protected java.lang.Class<?>loadClass(java.lang.String name, boolean resolve)private static java.lang.Stringunwrap(java.lang.String name)Unwraps the proxy decoration from around the given class name.private static java.lang.Stringwrap(java.lang.String name, java.lang.String kind)Wraps the given class name with the appropriate proxy decoration.-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Field Detail
-
SYSTEM_LOADER_LOCK
private static final java.lang.Object SYSTEM_LOADER_LOCK
-
PROVIDER_NAME
private static final java.lang.String PROVIDER_NAME
-
GLUE_SUFFIX
private static final java.lang.String GLUE_SUFFIX
- See Also:
- Constant Field Values
-
DYNAMIC
private static final java.lang.String DYNAMIC
- See Also:
- Constant Field Values
-
cachedGlue
private static final java.util.concurrent.ConcurrentMap<java.lang.Integer,GlueLoader> cachedGlue
-
-
Method Detail
-
dynamicGlue
public static <T> T dynamicGlue(com.google.inject.TypeLiteral<T> type, javax.inject.Provider<T> provider)Generates a new dynamic proxy instance for the given facade type and provider.- Parameters:
type- The facade typeprovider- The provider- Returns:
- Generated proxy instance
-
loadClass
protected java.lang.Class<?> loadClass(java.lang.String name, boolean resolve) throws java.lang.ClassNotFoundException- Overrides:
loadClassin classjava.lang.ClassLoader- Throws:
java.lang.ClassNotFoundException
-
findClass
protected java.lang.Class<?> findClass(java.lang.String name) throws java.lang.ClassNotFoundException- Overrides:
findClassin classjava.lang.ClassLoader- Throws:
java.lang.ClassNotFoundException
-
dynamicGlue
private static java.lang.Class<?> dynamicGlue(java.lang.Class<?> facade) throws java.lang.ClassNotFoundExceptionLoads the dynamic proxy class for the given facade class.- Throws:
java.lang.ClassNotFoundException
-
wrap
private static java.lang.String wrap(java.lang.String name, java.lang.String kind)Wraps the given class name with the appropriate proxy decoration.
-
unwrap
private static java.lang.String unwrap(java.lang.String name)
Unwraps the proxy decoration from around the given class name.
-
glue
private static GlueLoader glue(java.lang.ClassLoader parent)
Returns theGlueLoaderassociated with the givenClassLoader.
-
createGlue
private static GlueLoader createGlue(java.lang.ClassLoader parent)
Returns newGlueLoaderthat delegates to the givenClassLoader.
-
-