Class Markers

  • All Implemented Interfaces:
    Tree

    @Incubating(since="7.0.0")
    public class Markers
    extends java.lang.Object
    implements Tree
    • Field Detail

      • EMPTY

        public static final Markers EMPTY
    • Constructor Detail

      • Markers

        public Markers()
    • Method Detail

      • build

        public static Markers build​(java.util.Collection<? extends Marker> markers)
      • entries

        public java.util.Collection<? extends Marker> entries()
        TreeVisitor may respond to a marker to determine whether to act on a source file or not.
        Returns:
        A marker collection containing any additional context about the containing Tree element.
      • add

        public Markers add​(Marker marker)
        Adds a new marker element to the collection.
        Parameters:
        marker - The data to add or update.
        Returns:
        A new Markers with an added marker.
      • computeByType

        public <M extends MarkerMarkers computeByType​(M identity,
                                                        java.util.function.BinaryOperator<M> remappingFunction)
        Add a new marker or update some existing marker.
        Type Parameters:
        M - The type of marker.
        Parameters:
        identity - A new marker to add if it doesn't already exist. Existence is determined by type equality.
        remappingFunction - The function that merges an existing marker.
        Returns:
        A new Markers with an added or updated marker.
      • compute

        public <M extends MarkerMarkers compute​(M identity,
                                                  java.util.function.BinaryOperator<M> remappingFunction)
        Add a new marker or update some existing marker.
        Type Parameters:
        M - The type of marker.
        Parameters:
        identity - A new marker to add if it doesn't already exist. Existence is determined by regular equality.
        remappingFunction - The function that merges an existing marker with the new marker.
        Returns:
        A new Markers with an added or updated marker.
      • addIfAbsent

        public <M extends MarkerMarkers addIfAbsent​(M m)
        Add a new marker or update some existing marker.
        Type Parameters:
        M - The marker type.
        Parameters:
        m - A marker, which may or may not already exist already.
        Returns:
        If a marker already exists that matches by object equality, an unchanged markers reference is returned. Otherwise, the supplied marker is added.
      • findAll

        public <M extends Marker> java.util.List<M> findAll​(java.lang.Class<M> markerType)
      • findFirst

        public <M extends Marker> java.util.Optional<M> findFirst​(java.lang.Class<M> markerType)
      • searchResult

        public Markers searchResult()
      • isAcceptable

        public <P> boolean isAcceptable​(TreeVisitor<?,​P> v,
                                        P p)
        Description copied from interface: Tree
        Checks the supplied argument to see if the supplied visitor and its context would be valid arguments to accept(). Typically this involves checking that the visitor is of a type that operates on this kind of tree. e.g.: A Java Tree implementation would return true for JavaVisitors and false for MavenVisitors
        Specified by:
        isAcceptable in interface Tree
        Type Parameters:
        P - the visitor's context argument
        Returns:
        'true' if the arguments to this function would be valid arguments to accept()