Package com.google.inject.internal
Class DeclaredMembers
- java.lang.Object
-
- com.google.inject.internal.DeclaredMembers
-
public final class DeclaredMembers extends java.lang.Object
Utility class for retrieving declared fields or methods in a particular order, because the JVM doesn't guarantee ordering for listing declared methods. We don't externally guarantee an ordering, but having a consistent ordering allows deterministic behavior and simpler tests.
-
-
Field Summary
Fields Modifier and Type Field Description private static com.google.common.collect.Ordering<java.lang.Class<?>>
CLASS_ORDERING
An ordering suitable for comparing two classes if they are loaded by the same classloaderprivate static com.google.common.collect.Ordering<java.lang.reflect.Field>
FIELD_ORDERING
An ordering suitable for comparing two fields if they are owned by the same class.private static com.google.common.collect.Ordering<java.lang.reflect.Method>
METHOD_ORDERING
An ordering suitable for comparing two methods if they are owned by the same class.
-
Constructor Summary
Constructors Modifier Constructor Description private
DeclaredMembers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.reflect.Field[]
getDeclaredFields(java.lang.Class<?> type)
static java.lang.reflect.Method[]
getDeclaredMethods(java.lang.Class<?> type)
-
-
-
Field Detail
-
CLASS_ORDERING
private static final com.google.common.collect.Ordering<java.lang.Class<?>> CLASS_ORDERING
An ordering suitable for comparing two classes if they are loaded by the same classloaderWithin a single classloader there can only be one class with a given name, so we just compare the names.
-
FIELD_ORDERING
private static final com.google.common.collect.Ordering<java.lang.reflect.Field> FIELD_ORDERING
An ordering suitable for comparing two fields if they are owned by the same class.Within a single class it is sufficent to compare the non-generic field signature which consists of the field name and type.
-
METHOD_ORDERING
private static final com.google.common.collect.Ordering<java.lang.reflect.Method> METHOD_ORDERING
An ordering suitable for comparing two methods if they are owned by the same class.Within a single class it is sufficient to compare the non-generic method signature which consists of the name, return type and parameter types.
-
-