Package com.google.inject.internal.aop
Class ClassBuilding
java.lang.Object
com.google.inject.internal.aop.ClassBuilding
Entry-point for building enhanced classes and 'fast-class' invocation.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BytecodeGen.EnhancerBuilder
buildEnhancerBuilder
(Class<?> hostClass) Builder of enhancers that provide method interception via bytecode generation.buildFastClass
(Class<?> hostClass) Builds a 'fast-class' invoker that uses bytecode generation in place of reflection.private static boolean
canAccess
(Executable member, boolean samePackage) Can we access this member from a subclass which may be in the same package?static boolean
canEnhance
(Executable member) Returns true if the given member can be enhanced using bytecode.static boolean
canFastInvoke
(Executable member) Returns true if the given member can be fast-invoked.private static Method[]
Cache common overridable Object methods.private static boolean
private static boolean
mergeInterface
(List<Class<?>> interfaces, Class<?> candidate) Attempts to merge the interface with the current flattened hierarchy.private static Object
mergeMethods
(Object existing, Object added) Add the new method to an existing partition or create a new one.private static String
packageName
(String className) Extract the package name from a class name.private static void
partitionMethod
(Method method, Map<String, Object> partitions) Methods are partitioned by name and parameter count.private static void
pushInterfaces
(Deque<Class<?>[]> interfaceStack, Class<?>[] interfaces) Pushes the interface declaration onto the stack if it's not empty.static String
signature
(Constructor<?> constructor) Minimum signature needed to disambiguate constructors from the same host class.static String
Minimum signature needed to disambiguate methods from the same host class.private static String
Appends a semicolon-separated list of parameter types to the given name.private static void
visitFastConstructors
(Class<?> hostClass, Consumer<Constructor<?>> visitor) Visit all constructors for the host class that can be fast-invoked.private static void
visitFastMethods
(Class<?> hostClass, Consumer<Method> visitor) Visit all methods declared by the host class that can be fast-invoked.(package private) static <T extends Executable>
voidvisitMembers
(T[] members, boolean samePackage, Consumer<T> visitor) Visit all subclass accessible members in the given array.private static void
visitMethodHierarchy
(Class<?> hostClass, Consumer<Method> visitor) Visit the method hierarchy for the host class.
-
Field Details
-
OVERRIDABLE_OBJECT_METHODS
-
-
Constructor Details
-
ClassBuilding
private ClassBuilding()
-
-
Method Details
-
signature
Minimum signature needed to disambiguate constructors from the same host class. -
signature
Minimum signature needed to disambiguate methods from the same host class. -
signature
Appends a semicolon-separated list of parameter types to the given name. -
canEnhance
Returns true if the given member can be enhanced using bytecode. -
buildEnhancerBuilder
Builder of enhancers that provide method interception via bytecode generation. -
partitionMethod
Methods are partitioned by name and parameter count. This helps focus the search for bridge delegates that involve type-erasure of generic parameter types, since the parameter count will be the same for the bridge method and its delegate. -
mergeMethods
Add the new method to an existing partition or create a new one. -
visitMethodHierarchy
Visit the method hierarchy for the host class. -
pushInterfaces
Pushes the interface declaration onto the stack if it's not empty. -
mergeInterface
Attempts to merge the interface with the current flattened hierarchy. -
packageName
Extract the package name from a class name. -
getOverridableObjectMethods
Cache common overridable Object methods. -
canFastInvoke
Returns true if the given member can be fast-invoked. -
isPublic
-
buildFastClass
public static Function<String,BiFunction<Object, buildFastClassObject[], Object>> (Class<?> hostClass) Builds a 'fast-class' invoker that uses bytecode generation in place of reflection. -
visitFastConstructors
Visit all constructors for the host class that can be fast-invoked. -
visitFastMethods
Visit all methods declared by the host class that can be fast-invoked. -
visitMembers
static <T extends Executable> void visitMembers(T[] members, boolean samePackage, Consumer<T> visitor) Visit all subclass accessible members in the given array. -
canAccess
Can we access this member from a subclass which may be in the same package?
-