public final class BytecodeGen extends Object
faster reflection
, method
interceptors
and to proxy circular dependencies.
When loading classes, we need to be careful of:
OSGi
use class loader boundaries to
enforce modularity at runtime.
For each generated class, there's multiple class loaders involved:
Modifier and Type | Class and Description |
---|---|
static class |
BytecodeGen.Visibility
The required visibility of a user's class from a Guice-generated class.
|
Constructor and Description |
---|
BytecodeGen() |
Modifier and Type | Method and Description |
---|---|
static ClassLoader |
getClassLoader(Class<?> type)
Returns the class loader to host generated classes for
type . |
static net.sf.cglib.proxy.Enhancer |
newEnhancer(Class<?> type,
BytecodeGen.Visibility visibility) |
static net.sf.cglib.reflect.FastClass |
newFastClassForMember(Class<?> type,
Member member)
Returns a FastClass proxy for invoking the given member or
null if access rules
disallow it. |
static net.sf.cglib.reflect.FastClass |
newFastClassForMember(Member member)
Returns a FastClass proxy for invoking the given member or
null if access rules
disallow it. |
public static ClassLoader getClassLoader(Class<?> type)
type
.public static net.sf.cglib.reflect.FastClass newFastClassForMember(Member member)
null
if access rules
disallow it.for a full description
public static net.sf.cglib.reflect.FastClass newFastClassForMember(Class<?> type, Member member)
null
if access rules
disallow it.
FastClass works by generating a type in the same package as the target type
. This
may or may not work depending on the access level of the class/member. It breaks down into the
following cases depending on accessibility:
BridgeClassLoader
which ensures there are no versioning issues.
FastClass
as we do. This
may be violated when running in OSGI bundles.
public static net.sf.cglib.proxy.Enhancer newEnhancer(Class<?> type, BytecodeGen.Visibility visibility)
Copyright © 2006–2018 Google, Inc.. All rights reserved.