Class Selection<T>

java.lang.Object
co.yellowdog.platform.model.Selection<T>
Type Parameters:
T - the type of element being selected
All Implemented Interfaces:
Serializable

@ValidatedBy(SelectionValidator.class) public class Selection<T> extends Object implements Serializable
A selection of elements defined by an includes list, an excludes list, or both.

The matching semantics are as follows:

  • Include only the selection matches any element that appears in includes.
  • Exclude only the selection matches any element that does not appear in excludes.
  • Both specified includes takes precedence; the effective set is the includes list with any elements also present in excludes removed. Only elements that survive this filtering are matched.
  • Neither specified both lists are empty; the selection matches nothing.
See Also:
  • Constructor Details

    • Selection

      public Selection(List<T> includes, List<T> excludes)
      Creates a new Selection instance.
      Parameters:
      includes - Elements to include in the selection.

      When non-empty, only elements present in this list are candidates for matching (subject to further filtering by excludes).

      excludes - Elements to exclude from the selection.

      When includes is empty, this list defines the set of elements that are not matched. When includes is non-empty, elements present in both lists are removed from the effective include set.

  • Method Details

    • includes

      public static <T> Selection<T> includes(List<T> includes)
    • includes

      public static <T> Selection<T> includes(T... includes)
    • excludes

      public static <T> Selection<T> excludes(List<T> excludes)
    • excludes

      public static <T> Selection<T> excludes(T... excludes)
    • builder

      public static <T> Selection.Builder<T> builder()
    • getIncludes

      public List<T> getIncludes()
      Elements to include in the selection.

      When non-empty, only elements present in this list are candidates for matching (subject to further filtering by excludes).

    • getExcludes

      public List<T> getExcludes()
      Elements to exclude from the selection.

      When includes is empty, this list defines the set of elements that are not matched. When includes is non-empty, elements present in both lists are removed from the effective include set.

    • setIncludes

      public void setIncludes(List<T> includes)
      Elements to include in the selection.

      When non-empty, only elements present in this list are candidates for matching (subject to further filtering by excludes).

    • setExcludes

      public void setExcludes(List<T> excludes)
      Elements to exclude from the selection.

      When includes is empty, this list defines the set of elements that are not matched. When includes is non-empty, elements present in both lists are removed from the effective include set.

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object