Class BeanScanner<T>

  • Type Parameters:
    T - the type of the traversed items.

    public final class BeanScanner<T>
    extends Scanner<T>
    A scanner traversing an object graph.
    • Method Detail

      • from

        public static <X> Scanner<X> from​(X root)
        Creates a bean scanner.
        Type Parameters:
        X - the type of the root object.
        Parameters:
        root - the root object from which the graph will be traversed.
        Returns:
        a scanner for the root object.
      • find

        public <X> Scanner<X> find​(Class<X> clazz)
        Traverses the object graph for each items of this scanner and returns a scanner emitting the first item of the given type found in each branch.
        Overrides:
        find in class Scanner<T>
        Type Parameters:
        X - type of the selector and resulting items.
        Parameters:
        clazz - the type selector.
        Returns:
        a scanner emitting the selected items.
      • walk

        public <X> Scanner<X> walk​(Class<X> clazz)
        Traverses the object graph for each items of this scanner and returns a scanner emitting all found items of the given type.
        Overrides:
        walk in class Scanner<T>
        Type Parameters:
        X - type of the selector and resulting items.
        Parameters:
        clazz - the type selector.
        Returns:
        a scanner emitting the selected items.
      • create

        protected <X> Scanner<X> create​(Stream<X> source)
        Description copied from class: Scanner
        Constructs a scanner out of a source stream.
        Specified by:
        create in class Scanner<T>
        Type Parameters:
        X - the type of elements in the source stream.
        Parameters:
        source - the wrapped stream, will contain only one element when it is a root.
        Returns:
        a scanner based on the given source.