public static interface InheritanceProvider.ClassInfo
| Modifier and Type | Interface and Description |
|---|---|
static class |
InheritanceProvider.ClassInfo.Abstract
Abstract base implementation for
InheritanceProvider.ClassInfo that provides
a standard implementation of InheritanceProvider.ClassInfo.Abstract.equals(Object),
InheritanceProvider.ClassInfo.Abstract.hashCode() and InheritanceProvider.ClassInfo.Abstract.toString(). |
static class |
InheritanceProvider.ClassInfo.Impl
A default, simple implementation of
InheritanceProvider.ClassInfo. |
| Modifier and Type | Method and Description |
|---|---|
default boolean |
canInherit(InheritanceProvider.ClassInfo child,
FieldSignature field)
Returns whether the given child class could inherit the given field
from this parent class.
|
default boolean |
canInherit(InheritanceProvider.ClassInfo child,
MethodSignature method)
Returns whether the given child class could inherit the given method
from this parent class.
|
default InheritanceType |
getField(FieldSignature field)
Returns the
InheritanceType of a field declared in this class
that matches the given FieldSignature. |
Map<FieldSignature,InheritanceType> |
getFields()
Gets an unmodifiable view of all fields declared in the class.
|
Map<String,InheritanceType> |
getFieldsByName()
Gets an unmodifiable view of all field names declared in the class.
|
List<String> |
getInterfaces()
Gets an unmodifiable view of all the direct interfaces of the class.
|
default InheritanceType |
getMethod(MethodSignature method)
Returns the
InheritanceType of a method declared in this class
that matches the given MethodSignature. |
Map<MethodSignature,InheritanceType> |
getMethods()
Gets an unmodifiable view of all methods declared in the class.
|
String |
getName()
Gets the name of the class.
|
default String |
getPackage()
Gets the package name of the class.
|
String |
getSuperName()
Gets the name of this class' super class.
|
default boolean |
hasParent(InheritanceProvider.ClassInfo info,
InheritanceProvider provider)
Returns whether this class has another class as a parent.
|
default boolean |
hasParent(String klass,
InheritanceProvider provider)
Returns whether this class has another class as a parent.
|
boolean |
isInterface()
Gets whether the represented class is an interface.
|
default InheritanceProvider.ClassInfo |
lazy()
Returns a new
InheritanceProvider.ClassInfo that caches the information
returned by the getters in this interface. |
default boolean |
overrides(MethodSignature method,
InheritanceProvider.ClassInfo parent)
Returns whether this class overrides the specified method in the
given parent class.
|
default Set<InheritanceProvider.ClassInfo> |
provideParents(InheritanceProvider provider)
Gets an unmodifiable view of all parents of this class, recursively.
|
default void |
provideParents(InheritanceProvider provider,
Collection<InheritanceProvider.ClassInfo> parents)
Populates the given collection with all parents of this class, recursively.
|
String getName()
default String getPackage()
boolean isInterface()
true if the class is an interfaceString getSuperName()
Returns an empty string for interfaces or Object.
List<String> getInterfaces()
Map<FieldSignature,InheritanceType> getFields()
Map<String,InheritanceType> getFieldsByName()
Map<MethodSignature,InheritanceType> getMethods()
default Set<InheritanceProvider.ClassInfo> provideParents(InheritanceProvider provider)
If a class in the inheritance chain cannot be provided by the
given InheritanceProvider it will be missing in the result,
along with all its parent classes.
provider - The provider to use for looking up parent classesdefault void provideParents(InheritanceProvider provider, Collection<InheritanceProvider.ClassInfo> parents)
If a class in the inheritance chain cannot be provided by the
given InheritanceProvider it will be missing in the result,
along with all its parent classes.
provider - The provider to use for looking up parent classesparents - The collection to populatedefault boolean hasParent(String klass, InheritanceProvider provider)
This method may return unexpected results if a class in
the inheritance chain cannot be provided by the given
InheritanceProvider.
klass - The class to search in the parents of this classprovider - The provider to use for looking up parent classestrue if this class inherits from the specified classdefault boolean hasParent(InheritanceProvider.ClassInfo info, InheritanceProvider provider)
This method may return unexpected results if a class in
the inheritance chain cannot be provided by the given
InheritanceProvider.
info - The class to search in the parents of this classprovider - The provider to use for looking up parent classestrue if this class inherits from the specified classdefault InheritanceType getField(FieldSignature field)
InheritanceType of a field declared in this class
that matches the given FieldSignature.field - The field signatureInheritanceType.NONEdefault InheritanceType getMethod(MethodSignature method)
InheritanceType of a method declared in this class
that matches the given MethodSignature.method - The method signatureInheritanceType.NONEdefault boolean canInherit(InheritanceProvider.ClassInfo child, FieldSignature field)
Note: This method does not check if the given class actually
extends this class or interface.
Use #hasParent(ClassInfo, InheritanceProvider) to check this
additionally if necessary.
child - The child class to checkfield - The field to checktrue if the child class could inherit the methoddefault boolean canInherit(InheritanceProvider.ClassInfo child, MethodSignature method)
Note: This method does not check if the given class actually
extends this class or interface.
Use #hasParent(ClassInfo, InheritanceProvider) to check this
additionally if necessary.
child - The child class to checkmethod - The method to checktrue if the child class could inherit the methoddefault boolean overrides(MethodSignature method, InheritanceProvider.ClassInfo parent)
Note: This method does not check if the given class actually
extends this class or interface.
Use #hasParent(ClassInfo, InheritanceProvider) to check this
additionally if necessary.
method - The method to checkparent - The parent class to checktrue if this class overrides the methoddefault InheritanceProvider.ClassInfo lazy()
InheritanceProvider.ClassInfo that caches the information
returned by the getters in this interface.
This method is intended for usage by InheritanceProviders
to simplify their implementation. All InheritanceProvider.ClassInfo provided
by an InheritanceProvider should be lazy initialized
or otherwise cached.