public class ReflectHelpers
extends java.lang.Object
Classes and Methods.| Modifier and Type | Class and Description |
|---|---|
static class |
ReflectHelpers.ObjectsClassComparator
A
Comparator that uses the object's class' canonical name to compare them. |
| Modifier and Type | Field and Description |
|---|---|
static org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Function<java.lang.annotation.Annotation,java.lang.String> |
ANNOTATION_FORMATTER
A
Function that returns a concise string for a Annotation. |
static org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Function<java.lang.reflect.Method,java.lang.String> |
CLASS_AND_METHOD_FORMATTER
A
Function that turns a method into the declaring class + method signature. |
static org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Function<java.lang.Class<?>,java.lang.String> |
CLASS_NAME
A
Function with returns the classes name. |
static org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Function<java.lang.Class<?>,java.lang.String> |
CLASS_SIMPLE_NAME
A
Function with returns the classes name. |
static org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Function<java.lang.reflect.Method,java.lang.String> |
METHOD_FORMATTER
A
Function that turns a method into a simple method signature. |
static org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Function<java.lang.reflect.Type,java.lang.String> |
TYPE_SIMPLE_DESCRIPTION
A
Function that formats types. |
| Constructor and Description |
|---|
ReflectHelpers() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.ClassLoader |
findClassLoader()
Finds the appropriate
ClassLoader to be used by the ServiceLoader.load(java.lang.Class<S>, java.lang.ClassLoader) call,
which by default would use the context ClassLoader, which can be null. |
static java.lang.ClassLoader |
findClassLoader(java.lang.Class<?>... classes)
Find the common classloader of all these classes.
|
static java.lang.ClassLoader |
findClassLoader(java.lang.ClassLoader proposed)
Finds the appropriate
ClassLoader to be used by the ServiceLoader.load(java.lang.Class<S>, java.lang.ClassLoader) call,
which by default would use the proposed ClassLoader, which can be null. |
static java.lang.Iterable<java.lang.reflect.Method> |
getClosureOfMethodsOnInterface(java.lang.Class<?> iface)
Returns all the methods visible from
iface. |
static java.lang.Iterable<java.lang.reflect.Method> |
getClosureOfMethodsOnInterfaces(java.lang.Iterable<? extends java.lang.Class<?>> interfaces)
Returns all the methods visible from the provided interfaces.
|
static <T> java.lang.Iterable<T> |
loadServicesOrdered(java.lang.Class<T> iface)
A version of
loadServicesOrdered that uses a default class loader. |
static <T> java.lang.Iterable<T> |
loadServicesOrdered(java.lang.Class<T> iface,
java.lang.ClassLoader classLoader)
Returns instances of all implementations of the the specified
iface. |
public static final org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Function<java.lang.reflect.Method,java.lang.String> METHOD_FORMATTER
Function that turns a method into a simple method signature.public static final org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Function<java.lang.reflect.Method,java.lang.String> CLASS_AND_METHOD_FORMATTER
Function that turns a method into the declaring class + method signature.public static final org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Function<java.lang.Class<?>,java.lang.String> CLASS_NAME
Function with returns the classes name.public static final org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Function<java.lang.Class<?>,java.lang.String> CLASS_SIMPLE_NAME
Function with returns the classes name.public static final org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Function<java.lang.annotation.Annotation,java.lang.String> ANNOTATION_FORMATTER
Function that returns a concise string for a Annotation.public static final org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Function<java.lang.reflect.Type,java.lang.String> TYPE_SIMPLE_DESCRIPTION
Function that formats types.public static java.lang.Iterable<java.lang.reflect.Method> getClosureOfMethodsOnInterfaces(java.lang.Iterable<? extends java.lang.Class<?>> interfaces)
interfaces - The interfaces to use when searching for all their methods.Methods which interfaces expose.public static java.lang.Iterable<java.lang.reflect.Method> getClosureOfMethodsOnInterface(java.lang.Class<?> iface)
iface.iface - The interface to use when searching for all its methods.Methods which iface exposes.public static <T> java.lang.Iterable<T> loadServicesOrdered(java.lang.Class<T> iface,
java.lang.ClassLoader classLoader)
iface. Instances are
sorted by their class' name to ensure deterministic execution.T - The type of ifaceiface - The interface to load implementations ofclassLoader - The class loader to usepublic static <T> java.lang.Iterable<T> loadServicesOrdered(java.lang.Class<T> iface)
loadServicesOrdered that uses a default class loader.T - The type of ifaceiface - The interface to load implementations ofpublic static java.lang.ClassLoader findClassLoader(java.lang.ClassLoader proposed)
ClassLoader to be used by the ServiceLoader.load(java.lang.Class<S>, java.lang.ClassLoader) call,
which by default would use the proposed ClassLoader, which can be null. The fallback is
as follows: context ClassLoader, class ClassLoader and finaly the system ClassLoader.public static java.lang.ClassLoader findClassLoader(java.lang.Class<?>... classes)
public static java.lang.ClassLoader findClassLoader()
ClassLoader to be used by the ServiceLoader.load(java.lang.Class<S>, java.lang.ClassLoader) call,
which by default would use the context ClassLoader, which can be null. The fallback is
as follows: context ClassLoader, class ClassLoader and finaly the system ClassLoader.