Enum Class DistanceFormatter

java.lang.Object
java.lang.Enum<DistanceFormatter>
org.springframework.data.geo.format.DistanceFormatter
All Implemented Interfaces:
Serializable, Comparable<DistanceFormatter>, Constable, org.springframework.core.convert.converter.Converter<String,Distance>, org.springframework.format.Formatter<Distance>, org.springframework.format.Parser<Distance>, org.springframework.format.Printer<Distance>

public enum DistanceFormatter extends Enum<DistanceFormatter> implements org.springframework.core.convert.converter.Converter<String,Distance>, org.springframework.format.Formatter<Distance>
Converter to create Distance instances from String representations. The supported format is a decimal followed by whitespace and a metric abbreviation. We currently support the following abbreviations: SUPPORTED_METRICS.
Author:
Oliver Gierke, Christoph Strobl
  • Enum Constant Details

  • Method Details

    • values

      public static DistanceFormatter[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DistanceFormatter valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • convert

      @Nullable public final Distance convert(String source)
      Specified by:
      convert in interface org.springframework.core.convert.converter.Converter<String,Distance>
    • print

      public String print(Distance distance, Locale locale)
      Specified by:
      print in interface org.springframework.format.Printer<Distance>
    • parse

      public Distance parse(String text, Locale locale) throws ParseException
      Specified by:
      parse in interface org.springframework.format.Parser<Distance>
      Throws:
      ParseException