public class Classes extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Classes.Streaming
|
| Constructor and Description |
|---|
Classes() |
| Modifier and Type | Method and Description |
|---|---|
static int |
distance(Class<?> superClass,
Class<?> subClass)
Determines the distance between a class
<subClass> and a superordinate class from its lineage hierarchy
<superClass>, whereby the distance between a class and itself is always 0. |
static boolean |
isLineage(Class<?> superClass,
Class<?> subClass)
Determines whether there is an (possibly indirect but) explicit lineage relationship between two classes.
|
static Stream<Class<?>> |
lineageClasses(Class<?> subject)
Streams the lineage classes of a given class.
|
static Stream<Class<?>> |
lineageHierarchy(Class<?> subject)
Streams the lineage hierarchy of a given class.
|
static Stream<Class<?>> |
superior(Class<?> subject)
Streams, in a single step, all the direct
interfaces and, if any, the direct
superclass of a given Class. |
public static boolean isLineage(Class<?> superClass, Class<?> subClass)
Note: Any interface can be assigned to the class Object, for example,
but there is no explicit lineage relationship between Object and any interface.
NullPointerException - if one of the given Arguments is null.public static int distance(Class<?> superClass, Class<?> subClass)
<subClass> and a superordinate class from its lineage hierarchy
<superClass>, whereby the distance between a class and itself is always 0.
The distance between a class and its direct superclass or one of its direct
interfaces is always 1 and so on.IllegalArgumentException - if <superClass> ist not a superordinate class from the lineage
hierarchy of <subClass> or at least the <subClass> itself.NullPointerException - if one of the given Arguments is null.public static Stream<Class<?>> superior(Class<?> subject)
interfaces and, if any, the direct
superclass of a given Class.public static Stream<Class<?>> lineageClasses(Class<?> subject)
Stream that is composed of the lineage classes of the
(superclass and finally the mentioned class itself.public static Stream<Class<?>> lineageHierarchy(Class<?> subject)
Stream that is composed of the lineage hierarchy of any superordinate classes
(superclass and interfaces) and finally the
mentioned class itself.Copyright © 2020. All rights reserved.