Class CollectionSizeMatcher<T extends Iterable<?>>

java.lang.Object
net.bytebuddy.matcher.ElementMatcher.Junction.AbstractBase<T>
net.bytebuddy.matcher.CollectionSizeMatcher<T>
Type Parameters:
T - The type of the matched entity.
All Implemented Interfaces:
ElementMatcher<T>, ElementMatcher.Junction<T>

@Enhance public class CollectionSizeMatcher<T extends Iterable<?>> extends ElementMatcher.Junction.AbstractBase<T>
An element matcher that matches a collection by its size.
  • Field Details

    • size

      private final int size
      The expected size of the matched collection.
  • Constructor Details

    • CollectionSizeMatcher

      public CollectionSizeMatcher(int size)
      Creates a new matcher that matches the size of a matched collection.
      Parameters:
      size - The expected size of the matched collection.
  • Method Details

    • matches

      public boolean matches(T target)
      Matches a target against this element matcher.
      Parameters:
      target - The instance to be matched.
      Returns:
      true if the given element is matched by this matcher or false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object