java.lang.Object
org.springframework.data.mongodb.core.aggregation.Fields
All Implemented Interfaces:
Iterable<Field>

public final class Fields extends Object implements Iterable<Field>
Value object to capture a list of Field instances.
Since:
1.3
Author:
Oliver Gierke, Thomas Darimont
  • Field Details

  • Method Details

    • from

      public static Fields from(Field... fields)
      Creates a new Fields instance from the given Fields.
      Parameters:
      fields - must not be null or empty.
      Returns:
    • fields

      public static Fields fields(String... names)
      Creates a new Fields instance for Fields with the given names.
      Parameters:
      names - must not be null.
      Returns:
    • field

      public static Field field(String name)
      Creates a Field with the given name.
      Parameters:
      name - must not be null or empty.
      Returns:
    • field

      public static Field field(String name, String target)
      Creates a Field with the given name and target.

      The target is the name of the backing document field that will be aliased with name.

      Parameters:
      name -
      target - must not be null or empty
      Returns:
    • and

      public Fields and(String name)
      Creates a new Fields instance with a new Field of the given name added.
      Parameters:
      name - must not be null.
      Returns:
    • and

      public Fields and(String name, String target)
    • and

      public Fields and(Field field)
    • and

      public Fields and(Fields fields)
    • size

      public int size()
    • getField

      @Nullable public Field getField(String name)
    • iterator

      public Iterator<Field> iterator()
      Specified by:
      iterator in interface Iterable<Field>
    • asList

      public List<Field> asList()
      Returns:
      Since:
      1.10