E
- the common base class of all elements of some api analyzerpublic interface Element<E extends Element<E>> extends Comparable<E>
An element is comparable with all other element types for given language, giving a total ordering across all and any element types given language defines.
The Comparable.compareTo(Object)
method is used by Revapi to match up the pairs of elements from the old and new
API. Revapi sorts the elements from old and new API (using their natural order, i.e. using the compareTo
method) and then iterates through both sets at the same time, comparing the elements.
Comparison | Meaning | Result | Iteration Progress |
---|---|---|---|
old < new | New is considered removed from the API | (old, null) | Old moves forward, new stays |
old > new | Old is considered removed from the API | (null, new) | New moves forward, old stays |
old == new | New is considered equal to old | (old, new) | Old moves forward, new moves forward |
CoIterator
Modifier and Type | Method and Description |
---|---|
default <T extends Element<?>> |
as(Class<T> type)
Casts this element to the provided type.
|
API |
getApi() |
Archive |
getArchive() |
SortedSet<E> |
getChildren() |
String |
getFullHumanReadableString()
Provides the full "path" to the element in the forest in a human readable way.
|
E |
getParent() |
<T extends Element<E>> |
iterateOverChildren(Class<T> resultType,
boolean recurse,
Filter<? super T> filter)
Deprecated.
use the more standard
stream(Class, boolean) |
<T extends Element<E>> |
searchChildren(Class<T> resultType,
boolean recurse,
Filter<? super T> filter)
Deprecated.
in favor of
stream(Class, boolean) |
<T extends Element<E>> |
searchChildren(List<T> results,
Class<T> resultType,
boolean recurse,
Filter<? super T> filter)
Deprecated.
in favor of
stream(Class, boolean) |
void |
setParent(E parent)
Sets a new parent.
|
default <T extends Element<E>> |
stream(Class<T> elementType,
boolean recurse)
A stream equivalent of
iterateOverChildren(Class, boolean, Filter) . |
compareTo
default <T extends Element<?>> T as(Class<T> type)
type
- the type to cast this instance toClassCastException
- if this instance cannot be cast to the provided typeAPI getApi()
@Nullable Archive getArchive()
void setParent(@Nullable E parent)
parent
- the new parent of this elementString getFullHumanReadableString()
@Deprecated <T extends Element<E>> List<T> searchChildren(Class<T> resultType, boolean recurse, @Nullable Filter<? super T> filter)
stream(Class, boolean)
searchChildren(java.util.List, java.lang.Class, boolean,
org.revapi.query.Filter)
but returns the result in a newly allocated list instance. This is basically
a convenience method to enable a more succinct expressions.T
- the type of the elements to look forresultType
- the type of the elements to look forrecurse
- false to search only in direct children of the element, true to search recursivelyfilter
- optional filter to further trim the number of results @return the list of child elements of
given type potentially satisfying given filter@Deprecated <T extends Element<E>> void searchChildren(List<T> results, Class<T> resultType, boolean recurse, @Nullable Filter<? super T> filter)
stream(Class, boolean)
This is identical to searchChildren(Class, boolean, org.revapi.query.Filter)
in behavior but avoids
the instantiation of a new list.
T
- the type of the elements to look forresults
- the list of the results to fillresultType
- the type of the elements to look forrecurse
- false to search only in direct children of the element, true to search recursivelyfilter
- optional filter to further trim the number of results@Deprecated <T extends Element<E>> Iterator<T> iterateOverChildren(Class<T> resultType, boolean recurse, @Nullable Filter<? super T> filter)
stream(Class, boolean)
T
- the type of the elements to look forresultType
- the type of elements to look forrecurse
- if true, the iterator traverses the element forest using depth first searchfilter
- optional filter to further trim the number of resultssearchChildren(Class, boolean, org.revapi.query.Filter)
default <T extends Element<E>> java.util.stream.Stream<T> stream(Class<T> elementType, boolean recurse)
iterateOverChildren(Class, boolean, Filter)
. The resulting stream contains
distinct non-null elements.T
- the type of the elements to look forelementType
- the type of elements to look forrecurse
- if true, the iterator traverses the element forest using depth first searchCopyright © 2014-2021 Lukas Krejci. All Rights Reserved.