Class SortValue

java.lang.Object
org.elasticsearch.search.sort.SortValue
All Implemented Interfaces:
java.lang.Comparable<SortValue>, NamedWriteable, Writeable

public abstract class SortValue
extends java.lang.Object
implements NamedWriteable, java.lang.Comparable<SortValue>
A Comparable, DocValueFormat aware wrapper around a sort value.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable

    Writeable.Reader<V>, Writeable.Writer<V>
  • Method Summary

    Modifier and Type Method Description
    int compareTo​(SortValue other)  
    protected abstract int compareToSameType​(SortValue obj)
    Compare this sort value to another sort value of the same type.
    abstract boolean equals​(java.lang.Object obj)  
    abstract java.lang.String format​(DocValueFormat format)
    Format this value using the provided format.
    static SortValue from​(double d)
    Get a SortValue for a double.
    static SortValue from​(long l)
    Get a SortValue for a long.
    static SortValue from​(org.apache.lucene.util.BytesRef bytes)
    Get a SortValue for bytes.
    abstract java.lang.Object getKey()
    The java object representing the sort value.
    abstract int hashCode()  
    static java.util.List<NamedWriteableRegistry.Entry> namedWriteables()
    Get the list of NamedWriteables that this class needs.
    abstract java.lang.Number numberValue()
    Return this SortValue as a boxed Number.
    protected abstract org.elasticsearch.common.xcontent.XContentBuilder rawToXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder)
    Write the key as xcontent using the most native type possible.
    abstract java.lang.String toString()  
    org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, DocValueFormat format)
    Write the key as xcontent.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.elasticsearch.common.io.stream.NamedWriteable

    getWriteableName

    Methods inherited from interface org.elasticsearch.common.io.stream.Writeable

    writeTo
  • Method Details

    • from

      public static SortValue from​(double d)
      Get a SortValue for a double.
    • from

      public static SortValue from​(long l)
      Get a SortValue for a long.
    • from

      public static SortValue from​(org.apache.lucene.util.BytesRef bytes)
      Get a SortValue for bytes. Callers should be sure that they have a BytesRef.deepCopyOf(org.apache.lucene.util.BytesRef) of any mutable references.
    • namedWriteables

      public static java.util.List<NamedWriteableRegistry.Entry> namedWriteables()
      Get the list of NamedWriteables that this class needs.
    • compareTo

      public final int compareTo​(SortValue other)
      Specified by:
      compareTo in interface java.lang.Comparable<SortValue>
    • toXContent

      public final org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, DocValueFormat format) throws java.io.IOException
      Write the key as xcontent.
      Throws:
      java.io.IOException
    • getKey

      public abstract java.lang.Object getKey()
      The java object representing the sort value.
    • format

      public abstract java.lang.String format​(DocValueFormat format)
      Format this value using the provided format.
    • rawToXContent

      protected abstract org.elasticsearch.common.xcontent.XContentBuilder rawToXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder) throws java.io.IOException
      Write the key as xcontent using the most native type possible.
      Throws:
      java.io.IOException
    • compareToSameType

      protected abstract int compareToSameType​(SortValue obj)
      Compare this sort value to another sort value of the same type.
    • equals

      public abstract boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public abstract int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • toString

      public abstract java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • numberValue

      public abstract java.lang.Number numberValue()
      Return this SortValue as a boxed Number.