Top Description Inners Fields Constructors Methods
org.hibernate.bytecode.internal.bytebuddy

public Class HibernateMethodLookupDispatcher

extends Object
Class Inheritance
Imports
java.lang.reflect.Method, java.security.AccessController, .PrivilegedAction, java.util.Set, java.util.concurrent.ConcurrentHashMap, java.util.function.Function, java.util.stream.Stream, org.hibernate.HibernateException, org.hibernate.internal.util.securitymanager.SystemSecurityManager

This dispatcher analyzes the stack frames to detect if a particular call should be authorized.

Authorized classes are registered when creating the ByteBuddy proxies.

It should only be used when the Security Manager is enabled.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
HibernateMethodLookupDispatcher.StackWalkerGetCallerStackAction

A privileged action that retrieves the caller stack using a stack walker.

Field Summary

Modifier and TypeField and Description
private static Set<String>
private static final PrivilegedAction<Class<?>[]>
private static final int
MAX_STACK_FRAMES

The maximum number of stack frames to explore to find the caller frame.

private static final int
MIN_STACK_FRAMES

The minimum number of stack frames to drop before we can hope to find the caller frame.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static Method
private static Class<?>
public static Method
getDeclaredMethod(Class<?> type, String name, Class<?>[] parameters)

public static Method
getMethod(Class<?> type, String name, Class<?>[] parameters)

pack-priv static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

authorizedClassesback to summary
private static Set<String> authorizedClasses
GET_CALLER_STACK_ACTIONback to summary
private static final PrivilegedAction<Class<?>[]> GET_CALLER_STACK_ACTION
MAX_STACK_FRAMESback to summary
private static final int MAX_STACK_FRAMES

The maximum number of stack frames to explore to find the caller frame.

Beyond that, we give up and throw an exception.

MIN_STACK_FRAMESback to summary
private static final int MIN_STACK_FRAMES

The minimum number of stack frames to drop before we can hope to find the caller frame.

Constructor Detail

HibernateMethodLookupDispatcherback to summary
public HibernateMethodLookupDispatcher()

Method Detail

doPrivilegedActionback to summary
private static Method doPrivilegedAction(PrivilegedAction<Method> privilegedAction)
getCallerClassback to summary
private static Class<?> getCallerClass()
getDeclaredMethodback to summary
public static Method getDeclaredMethod(Class<?> type, String name, Class<?>[] parameters)
getMethodback to summary
public static Method getMethod(Class<?> type, String name, Class<?>[] parameters)
registerAuthorizedClassback to summary
pack-priv static void registerAuthorizedClass(String className)
org.hibernate.bytecode.internal.bytebuddy back to summary

private Class HibernateMethodLookupDispatcher.StackWalkerGetCallerStackAction

extends Object
implements PrivilegedAction<Class<?>[]>
Class Inheritance
  • java.lang.Object
  • org.hibernate.bytecode.internal.bytebuddy.HibernateMethodLookupDispatcher.StackWalkerGetCallerStackAction
All Implemented Interfaces
java.security.PrivilegedAction

A privileged action that retrieves the caller stack using a stack walker.

Field Summary

Modifier and TypeField and Description
private final Function<Stream<StackWalker.StackFrame>, Class<?>[]>
private final Function<StackWalker.StackFrame, Class<?>>
private final StackWalker

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Class<?>[]
run()

Implements java.security.PrivilegedAction.run.

Performs the computation.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

stackFrameExtractFunctionback to summary
private final Function<Stream<StackWalker.StackFrame>, Class<?>[]> stackFrameExtractFunction
stackFrameGetDeclaringClassFunctionback to summary
private final Function<StackWalker.StackFrame, Class<?>> stackFrameGetDeclaringClassFunction
stackWalkerback to summary
private final StackWalker stackWalker

Constructor Detail

StackWalkerGetCallerStackActionback to summary
pack-priv StackWalkerGetCallerStackAction(StackWalker stackWalker)

Method Detail

runback to summary
public Class<?>[] run()

Implements java.security.PrivilegedAction.run.

Doc from java.security.PrivilegedAction.run.

Performs the computation. This method will be called by AccessController.doPrivileged after enabling privileges.

Returns:Class<?>[]

a class-dependent value that may represent the results of the computation. Each class that implements PrivilegedAction should document what (if anything) this value represents.

Annotations
@Override