Top Description Fields Constructors Methods
com.google.inject.internal.aop

public final Class ClassBuilding

extends Object
Class Inheritance
Static Imports
com.google.inject.internal.aop.ClassDefining.hasPackageAccess, java.lang.reflect.Modifier.FINAL, .Modifier.PRIVATE, .Modifier.PROTECTED, .Modifier.PUBLIC, .Modifier.STATIC

Entry-point for building enhanced classes and 'fast-class' invocation.
Author
[email protected] (Stuart McCulloch)

Field Summary

Modifier and TypeField and Description
private static final Method[]

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static BytecodeGen.EnhancerBuilder
buildEnhancerBuilder(Class<?> hostClass)

Builder of enhancers that provide method interception via bytecode generation.

public static Function<String, BiFunction<Object, Object[], Object>>
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?

public static boolean
canEnhance(Executable member)

Returns true if the given member can be enhanced using bytecode.

public static boolean
canFastInvoke(Executable member)

Returns true if the given member can be fast-invoked.

private static Method[]
getOverridableObjectMethods()

Cache common overridable Object methods.

private static boolean
isPublic(Class<?> clazz)

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.

public static String
signature(Constructor<?> constructor)

Minimum signature needed to disambiguate constructors from the same host class.

public static String
signature(Method method)

Minimum signature needed to disambiguate methods from the same host class.

private static String
signature(String name, Class<?>[] parameterTypes)

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.

pack-priv static <T extends Executable> void
visitMembers(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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

OVERRIDABLE_OBJECT_METHODSback to summary
private static final Method[] OVERRIDABLE_OBJECT_METHODS

Constructor Detail

ClassBuildingback to summary
private ClassBuilding()

Method Detail

buildEnhancerBuilderback to summary
public static BytecodeGen.EnhancerBuilder buildEnhancerBuilder(Class<?> hostClass)

Builder of enhancers that provide method interception via bytecode generation.

buildFastClassback to summary
public static Function<String, BiFunction<Object, Object[], Object>> buildFastClass(Class<?> hostClass)

Builds a 'fast-class' invoker that uses bytecode generation in place of reflection.

canAccessback to summary
private static boolean canAccess(Executable member, boolean samePackage)

Can we access this member from a subclass which may be in the same package?

canEnhanceback to summary
public static boolean canEnhance(Executable member)

Returns true if the given member can be enhanced using bytecode.

canFastInvokeback to summary
public static boolean canFastInvoke(Executable member)

Returns true if the given member can be fast-invoked.

getOverridableObjectMethodsback to summary
private static Method[] getOverridableObjectMethods()

Cache common overridable Object methods.

isPublicback to summary
private static boolean isPublic(Class<?> clazz)
mergeInterfaceback to summary
private static boolean mergeInterface(List<Class<?>> interfaces, Class<?> candidate)

Attempts to merge the interface with the current flattened hierarchy.

mergeMethodsback to summary
private static Object mergeMethods(Object existing, Object added)

Add the new method to an existing partition or create a new one.

packageNameback to summary
private static String packageName(String className)

Extract the package name from a class name.

partitionMethodback to summary
private static void partitionMethod(Method method, Map<String, Object> partitions)

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.

pushInterfacesback to summary
private static void pushInterfaces(Deque<Class<?>[]> interfaceStack, Class<?>[] interfaces)

Pushes the interface declaration onto the stack if it's not empty.

signatureback to summary
public static String signature(Constructor<?> constructor)

Minimum signature needed to disambiguate constructors from the same host class.

signatureback to summary
public static String signature(Method method)

Minimum signature needed to disambiguate methods from the same host class.

signatureback to summary
private static String signature(String name, Class<?>[] parameterTypes)

Appends a semicolon-separated list of parameter types to the given name.

visitFastConstructorsback to summary
private static void visitFastConstructors(Class<?> hostClass, Consumer<Constructor<?>> visitor)

Visit all constructors for the host class that can be fast-invoked.

visitFastMethodsback to summary
private static void visitFastMethods(Class<?> hostClass, Consumer<Method> visitor)

Visit all methods declared by the host class that can be fast-invoked.

visitMembersback to summary
pack-priv static <T extends Executable> void visitMembers(T[] members, boolean samePackage, Consumer<T> visitor)

Visit all subclass accessible members in the given array.

visitMethodHierarchyback to summary
private static void visitMethodHierarchy(Class<?> hostClass, Consumer<Method> visitor)

Visit the method hierarchy for the host class.