@ParametersAreNonnullByDefault public final class MoreReflection extends Object
| Modifier and Type | Method and Description |
|---|---|
static Set<Class<?>> |
getAllInterfaces(Class<?> type)
Retrieves all interfaces implemented by the given class and its superclasses.
|
static <T> T |
newInstance(Class<T> type)
Gets or creates a instance of the given
type by using the static method named name. |
@Nonnull public static <T> T newInstance(Class<T> type)
type by using the static method named name.
If the type is annotated by Singleton or by Builder, then the static method identified by
the value of the annotation is used to get the instance. Otherwise, the default constructor is used.
T - the type of the instancetype - the class to look fortype is a singleton, or a new instanceReflectionException - if an error occurs during the instantiation@Nonnull public static Set<Class<?>> getAllInterfaces(Class<?> type)
The order is determined by looking through each interface in turn as declared in the source file and following its hierarchy up. Then each superclass is considered in the same way. Later duplicates are ignored, so the order is maintained.
type - the class to look upSet of interfaces in orderCopyright © 2017–2019 Atlanmod. All rights reserved.