Interface Id<T extends Id>

Type Parameters:
T - concrete implementation class, needed for typesafe implementation of compare interface
All Superinterfaces:
Comparable<T>
All Known Implementing Classes:
IdLong, IdString, IdUuid

public interface Id<T extends Id> extends Comparable<T>
the interface that all Id implementations need to implement.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the value, formatted for inserting into a JSON document.
    Get the value, formatted for use in a url.
    Get the raw value of this Id.
    static Id
     
    void
    writeTo(com.fasterxml.jackson.core.JsonGenerator gen)
    Write the value to the given JsonGenerator.

    Methods inherited from interface java.lang.Comparable

    compareTo
  • Method Details

    • tryToParse

      static Id tryToParse(String input)
    • getValue

      Object getValue()
      Get the raw value of this Id.
      Returns:
      the raw value of this Id.
    • getUrl

      String getUrl()
      Get the value, formatted for use in a url. String values will be quoted with single quotes.
      Returns:
      the value, formatted for use in a url.
    • getJson

      String getJson()
      Get the value, formatted for inserting into a JSON document. In general, it is better to use a json mapper, and pass it the Object returned by getValue().
      Returns:
      the value, formatted for use in JSON.
    • writeTo

      void writeTo(com.fasterxml.jackson.core.JsonGenerator gen) throws IOException
      Write the value to the given JsonGenerator.
      Parameters:
      gen - The JsonGenerator to write to.
      Throws:
      IOException - if the generator throws.