Top Description Inners Fields Constructors Methods
org.hibernate.validator.internal.util

public final Class ExecutableHelper

extends Object
Class Inheritance
Imports
java.lang.annotation.ElementType, java.lang.invoke.MethodHandles, java.lang.reflect.Constructor, .Executable, .Method, .Modifier, java.security.AccessController, .PrivilegedAction, org.hibernate.validator.internal.IgnoreForbiddenApisErrors, org.hibernate.validator.internal.properties.Callable, .Signature, org.hibernate.validator.internal.util.classhierarchy.Filters, org.hibernate.validator.internal.util.logging.Log, .LoggerFactory, org.hibernate.validator.internal.util.privilegedactions.GetResolvedMemberMethods, com.fasterxml.classmate.Filter, .MemberResolver, .ResolvedType, .ResolvedTypeWithMembers, .TypeResolver, com.fasterxml.classmate.members.RawMethod, .ResolvedMethod

Provides shared functionality dealing with executables.
Authors
Hardy Ferentschik, Gunnar Morling, Kevin Pollet <[email protected]> (C) 2011 SERLI

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
ExecutableHelper.SimpleMethodFilter

A filter implementation filtering methods matching given methods.

Field Summary

Modifier and TypeField and Description
private static final Log
private final TypeResolver

Constructor Summary

AccessConstructor and Description
public
ExecutableHelper(TypeResolutionHelper typeResolutionHelper)

Method Summary

Modifier and TypeMethod and Description
public static ElementType
public static String

Returns:

A string representation of the given executable.
getExecutableAsString
(String
the name of the executable
name
,
Class<?>...
the types of the executable's parameters
parameterTypes
)

Returns a string representation of an executable with the given name and parameter types in the form <name>(<parameterType 0> ...

public static Signature
public static Signature
getSignature(String name, Class<?>[] parameterTypes)

public static String
private boolean

Returns:

true if the parameters of the two methods resolve to the same types, false otherwise.
instanceMethodParametersResolveToSameTypes
(Method
a method on a supertype
subTypeMethod
,
Method
a method on a subtype
superTypeMethod
)

Whether the parameters of the two given instance methods resolve to the same types or not.

private boolean
private static boolean
isMethodVisibleTo(Method visibleMethod, Method otherMethod)

public boolean

Returns:

true if a pair of methods are equal left == right, or one of the methods override another one in the class hierarchy with mainSubType at the bottom, false otherwise.
isResolvedToSameMethodInHierarchy
(Class<?>
a type at the bottom of class hierarchy to be used to lookup the methods.
mainSubType
,
Method
one of the methods to check
left
,
Method
another of the methods to check
right
)

Checks if a pair of given methods (left and right) are resolved to the same method based on the mainSubType type.

public boolean
overrides(Callable subTypeMethod, Callable superTypeMethod)

public boolean

Returns:

Returns true if subTypeMethod overrides superTypeMethod, false otherwise.
overrides
(Method
The sub type method (cannot be null).
subTypeMethod
,
Method
The super type method (cannot be null).
superTypeMethod
)

Checks, whether subTypeMethod overrides superTypeMethod.

private <T> T
run(PrivilegedAction<T> action)

Runs the given privileged action, using a privileged block if required.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGback to summary
private static final Log LOG
typeResolverback to summary
private final TypeResolver typeResolver

Constructor Detail

ExecutableHelperback to summary
public ExecutableHelper(TypeResolutionHelper typeResolutionHelper)

Method Detail

getElementTypeback to summary
public static ElementType getElementType(Executable executable)
getExecutableAsStringback to summary
public static String getExecutableAsString(String name, Class<?>... parameterTypes)

Returns a string representation of an executable with the given name and parameter types in the form <name>(<parameterType 0> ... <parameterType n>), e.g. for logging purposes.

Parameters
name:String

the name of the executable

parameterTypes:Class<?>[]

the types of the executable's parameters

Returns:String

A string representation of the given executable.

getSignatureback to summary
public static Signature getSignature(Executable executable)
getSignatureback to summary
public static Signature getSignature(String name, Class<?>[] parameterTypes)
getSimpleNameback to summary
public static String getSimpleName(Executable executable)
instanceMethodParametersResolveToSameTypesback to summary
private boolean instanceMethodParametersResolveToSameTypes(Method subTypeMethod, Method superTypeMethod)

Whether the parameters of the two given instance methods resolve to the same types or not. Takes type parameters into account.

Parameters
subTypeMethod:Method

a method on a supertype

superTypeMethod:Method

a method on a subtype

Returns:boolean

true if the parameters of the two methods resolve to the same types, false otherwise.

instanceMethodParametersResolveToSameTypesback to summary
private boolean instanceMethodParametersResolveToSameTypes(Class<?> mainSubType, Method left, Method right)
isMethodVisibleToback to summary
private static boolean isMethodVisibleTo(Method visibleMethod, Method otherMethod)
isResolvedToSameMethodInHierarchyback to summary
public boolean isResolvedToSameMethodInHierarchy(Class<?> mainSubType, Method left, Method right)

Checks if a pair of given methods (left and right) are resolved to the same method based on the mainSubType type.

Parameters
mainSubType:Class<?>

a type at the bottom of class hierarchy to be used to lookup the methods.

left:Method

one of the methods to check

right:Method

another of the methods to check

Returns:boolean

true if a pair of methods are equal left == right, or one of the methods override another one in the class hierarchy with mainSubType at the bottom, false otherwise.

overridesback to summary
public boolean overrides(Callable subTypeMethod, Callable superTypeMethod)
overridesback to summary
public boolean overrides(Method subTypeMethod, Method superTypeMethod)

Checks, whether subTypeMethod overrides superTypeMethod.

Parameters
subTypeMethod:Method

The sub type method (cannot be null).

superTypeMethod:Method

The super type method (cannot be null).

Returns:boolean

Returns true if subTypeMethod overrides superTypeMethod, false otherwise.

runback to summary
private <T> T run(PrivilegedAction<T> action)

Runs the given privileged action, using a privileged block if required.

Note

This must never be changed into a publicly available method to avoid execution of arbitrary privileged actions within HV's protection domain.

Annotations
@IgnoreForbiddenApisErrors
reason:SecurityManager is deprecated in JDK17
org.hibernate.validator.internal.util back to summary

private Class ExecutableHelper.SimpleMethodFilter

extends Object
implements Filter<RawMethod>
Class Inheritance
  • java.lang.Object
  • org.hibernate.validator.internal.util.ExecutableHelper.SimpleMethodFilter
All Implemented Interfaces
com.fasterxml.classmate.Filter

A filter implementation filtering methods matching given methods.
Author
Gunnar Morling

Field Summary

Modifier and TypeField and Description
private final Method
private final Method

Constructor Summary

AccessConstructor and Description
private
SimpleMethodFilter(Method method1, Method method2)

Method Summary

Modifier and TypeMethod and Description
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

method1back to summary
private final Method method1
method2back to summary
private final Method method2

Constructor Detail

SimpleMethodFilterback to summary
private SimpleMethodFilter(Method method1, Method method2)

Method Detail

includeback to summary
public boolean include(RawMethod element)

Implements com.fasterxml.classmate.Filter.include.

Annotations
@Override