Class BeanStream

java.lang.Object
io.quarkus.arc.processor.BeanStream
All Implemented Interfaces:
Iterable<BeanInfo>

public final class BeanStream extends Object implements Iterable<BeanInfo>
Convenient Stream wrapper that can be used to filter a set of beans.

This object is stateful and cannot be reused. After a terminal opration is performed, the underlying stream is considered consumed, and can no longer be used.

This construct is not threadsafe.

  • Constructor Details

  • Method Details

    • withScope

      public BeanStream withScope(Class<? extends Annotation> scope)
      Parameters:
      scopeName -
      Returns:
      the new stream of beans
      See Also:
    • withScope

      public BeanStream withScope(org.jboss.jandex.DotName scopeName)
      Parameters:
      scopeName -
      Returns:
      the new stream of beans
      See Also:
    • withBeanType

      public BeanStream withBeanType(Class<?> beanType)
      Parameters:
      beanType -
      Returns:
      the new stream of beans
      See Also:
    • withBeanType

      public BeanStream withBeanType(org.jboss.jandex.DotName beanTypeName)
      Parameters:
      beanType -
      Returns:
      the new stream of beans
      See Also:
    • withBeanType

      public BeanStream withBeanType(org.jboss.jandex.Type beanType)
      Parameters:
      beanType -
      Returns:
      the new stream of beans
      See Also:
    • withBeanClass

      public BeanStream withBeanClass(Class<?> beanClass)
      Parameters:
      beanClass -
      Returns:
      the new stream of beans
      See Also:
    • matchBeanTypes

      public BeanStream matchBeanTypes(Predicate<Set<org.jboss.jandex.Type>> predicate)
      Parameters:
      predicate -
      Returns:
      the new stream of beans
    • withTarget

      public BeanStream withTarget()
      Returns:
      the new stream of beans
      See Also:
    • withBeanClass

      public BeanStream withBeanClass(org.jboss.jandex.DotName beanClass)
      Parameters:
      beanClass -
      Returns:
      the new stream of beans
      See Also:
    • withQualifier

      @SafeVarargs public final BeanStream withQualifier(Class<? extends Annotation>... qualifiers)
      Parameters:
      qualifier -
      Returns:
      the new stream of beans
      See Also:
    • withQualifier

      public BeanStream withQualifier(org.jboss.jandex.DotName... qualifierNames)
      Parameters:
      qualifierNames -
      Returns:
      the new stream of beans
      See Also:
    • withName

      public BeanStream withName(String name)
      Parameters:
      name -
      Returns:
      the new stream of beans
      See Also:
    • withName

      public BeanStream withName()
      Returns:
      the new stream of beans
      See Also:
    • withAroundInvokeInterceptor

      public BeanStream withAroundInvokeInterceptor()
      Returns:
      the new stream of beans that have an associated interceptor
    • withLifecycleInterceptor

      public BeanStream withLifecycleInterceptor()
      Returns:
      the new stream of beans that have an associated lifecycle interceptor
    • findByIdentifier

      public Optional<BeanInfo> findByIdentifier(String id)
      Parameters:
      id -
      Returns:
      an Optional with the matching bean, or an empty Optional if no such bean is found
      See Also:
    • producers

      public BeanStream producers()
      Returns:
      the new stream of producer beans
    • producerMethods

      public BeanStream producerMethods()
      Returns:
      the new stream of producer method beans
    • producerFields

      public BeanStream producerFields()
      Returns:
      the new stream of producer field beans
    • classBeans

      public BeanStream classBeans()
      Returns:
      the new stream of class beans
    • syntheticBeans

      public BeanStream syntheticBeans()
      Returns:
      the new stream of synthetic beans
    • namedBeans

      public BeanStream namedBeans()
      Returns:
      the new stream of named beans
      See Also:
    • defaultBeans

      public BeanStream defaultBeans()
      Returns:
      the new stream of default beans
      See Also:
    • alternativeBeans

      public BeanStream alternativeBeans()
      Returns:
      the new stream of default beans
      See Also:
    • assignableTo

      public BeanStream assignableTo(org.jboss.jandex.Type requiredType, org.jboss.jandex.AnnotationInstance... requiredQualifiers)
      Parameters:
      requiredType -
      requiredQualifiers -
      Returns:
      the new stream of beans assignable to the required type and qualifiers
    • filter

      public BeanStream filter(Predicate<BeanInfo> predicate)
      Parameters:
      predicate -
      Returns:
      the new stream
    • collect

      public List<BeanInfo> collect()
      Terminal operation.
      Returns:
      the list of beans
    • stream

      public Stream<BeanInfo> stream()
      Returns:
      the underlying stream instance
    • isEmpty

      public boolean isEmpty()
      Terminal operation.
      Returns:
      true if the stream contains no elements
    • iterator

      public Iterator<BeanInfo> iterator()
      Terminal operation.
      Specified by:
      iterator in interface Iterable<BeanInfo>
      Returns:
      the iterator
    • firstResult

      public Optional<BeanInfo> firstResult()
      Terminal operation.
      Returns:
      an Optional with the first matching bean, or an empty Optional if no bean is matching
    • collect

      public <R, A> R collect(Collector<BeanInfo,A,R> collector)
      Terminal operation.
      Type Parameters:
      R -
      A -
      Parameters:
      collector -
      Returns:
      the collected result