Package org.revapi.simple
Class SimpleElement
- java.lang.Object
-
- org.revapi.simple.SimpleElement
-
- All Implemented Interfaces:
Cloneable
,Comparable
,Element
@Deprecated public abstract class SimpleElement extends Object implements Element, Cloneable
Deprecated.useBaseElement
insteadA simple implementation of theElement
interface intended to be extended.- Since:
- 0.1
- Author:
- Lukas Krejci
-
-
Constructor Summary
Constructors Constructor Description SimpleElement()
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description SimpleElement
clone()
Deprecated.Returns a shallow copy of this element.SortedSet<? extends Element>
getChildren()
Deprecated.This default implementation uses thenewChildrenInstance()
to initialize the children set and wraps it in a private set implementation that automagically changes the parent of the elements based on the membership.protected <T extends Element>
List<T>getDirectChildrenOfType(Class<T> type)
Deprecated.String
getFullHumanReadableString()
Deprecated.This default implementation assumes thattoString()
can do the job.Element
getParent()
Deprecated.Iterator
iterateOverChildren(Class resultType, boolean recurse, Filter filter)
Deprecated.Similar to search methods but avoids the traversal over the whole forest.protected SortedSet<Element>
newChildrenInstance()
Deprecated.Override this method if you need some specialized instance of sorted set or want to do some custom pre-populating or initialization of the children.List
searchChildren(Class resultType, boolean recurse, Filter filter)
Deprecated.This method is functionally equivalent toElement.searchChildren(java.util.List, java.lang.Class, boolean, org.revapi.query.Filter)
but returns the result in a newly allocated list instance.void
searchChildren(List results, Class resultType, boolean recurse, Filter filter)
Deprecated.Recursively searches the children of this element for elements of given type, potentially applicable to given filter.void
setParent(Element parent)
Deprecated.Sets the parent element.-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface org.revapi.Element
as, getApi, getArchive, getCumulativeReferencedElements, getCumulativeReferencingElements, getReferencedElements, getReferencingElements, stream
-
-
-
-
Method Detail
-
clone
public SimpleElement clone()
Deprecated.Returns a shallow copy of this element. In particular, its parent and children will be cleared.
-
getChildren
@Nonnull public SortedSet<? extends Element> getChildren()
Deprecated.This default implementation uses thenewChildrenInstance()
to initialize the children set and wraps it in a private set implementation that automagically changes the parent of the elements based on the membership.- Specified by:
getChildren
in interfaceElement
- Returns:
- children of this element
-
newChildrenInstance
@Nonnull protected SortedSet<Element> newChildrenInstance()
Deprecated.Override this method if you need some specialized instance of sorted set or want to do some custom pre-populating or initialization of the children. This default implementation merely returns an empty newTreeSet
instance.- Returns:
- a new sorted set instance to store the children in
-
setParent
public void setParent(@Nullable Element parent)
Deprecated.Sets the parent element. No other processing is automagically done (i.e. the parent's children set is NOT updated by calling this method).
-
searchChildren
@Nonnull public final List searchChildren(@Nonnull Class resultType, boolean recurse, @Nullable Filter filter)
Deprecated.Description copied from interface:Element
This method is functionally equivalent toElement.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.- Specified by:
searchChildren
in interfaceElement
- Parameters:
resultType
- 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- Returns:
- the list of found elements
-
searchChildren
public final void searchChildren(@Nonnull List results, @Nonnull Class resultType, boolean recurse, @Nullable Filter filter)
Deprecated.Description copied from interface:Element
Recursively searches the children of this element for elements of given type, potentially applicable to given filter.This is identical to
Element.searchChildren(Class, boolean, org.revapi.query.Filter)
in behavior but avoids the instantiation of a new list.- Specified by:
searchChildren
in interfaceElement
- Parameters:
results
- 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
-
getFullHumanReadableString
@Nonnull public String getFullHumanReadableString()
Deprecated.This default implementation assumes thattoString()
can do the job.- Specified by:
getFullHumanReadableString
in interfaceElement
- Returns:
- the human readable representation of this element
- See Also:
Element.getFullHumanReadableString()
-
iterateOverChildren
@Nonnull public Iterator iterateOverChildren(@Nonnull Class resultType, boolean recurse, @Nullable Filter filter)
Deprecated.Description copied from interface:Element
Similar to search methods but avoids the traversal over the whole forest. Instead the traversal is incremental and governed by the returned iterator.- Specified by:
iterateOverChildren
in interfaceElement
- Parameters:
resultType
- 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 results- Returns:
- the iterator that will iterate over the results
- See Also:
Element.searchChildren(Class, boolean, org.revapi.query.Filter)
-
-