java.lang.Object
org.springframework.data.mongodb.core.index.IndexField

public final class IndexField extends Object
Value object for an index field.
Author:
Oliver Gierke, Christoph Strobl
  • Method Details

    • create

      public static IndexField create(String key, Sort.Direction order)
    • geo

      public static IndexField geo(String key)
      Creates a geo IndexField for the given key.
      Parameters:
      key - must not be null or empty.
      Returns:
      new instance of IndexField.
    • text

      public static IndexField text(String key, Float weight)
      Creates a text IndexField for the given key.
      Since:
      1.6
    • getKey

      public String getKey()
      Returns:
      the key
    • getDirection

      @Nullable public Sort.Direction getDirection()
      Returns the direction of the IndexField or null in case we have a geo index field.
      Returns:
      the direction
    • isGeo

      public boolean isGeo()
      Returns whether the IndexField is a geo index field.
      Returns:
      true if type is IndexField.Type.GEO.
    • isText

      public boolean isText()
      Returns whether the IndexField is a text index field.
      Returns:
      true if type is IndexField.Type.TEXT
      Since:
      1.6
    • isHashed

      public boolean isHashed()
      Returns whether the IndexField is a hashed.
      Returns:
      true if IndexField is hashed.
      Since:
      2.2
    • isWildcard

      public boolean isWildcard()
      Returns whether the IndexField is contains a wildcard expression.
      Returns:
      true if IndexField contains a wildcard $**.
      Since:
      3.3
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object