Class ReportKey<T>

java.lang.Object
uk.ac.starlink.ttools.plot2.ReportKey<T>

public abstract class ReportKey<T> extends Object
Typed key for use in a ReportMap. Instances of this class identify an item of data generated when plotting a layer. They are classed as "general interest" or not. General interest keys represent data that clients could consider passing on to a human user, while non-general-interest ones are generally intended for consumption by parts of the implementation that understand the details of particular report types.
Since:
9 Dec 2014
Author:
Mark Taylor
  • Constructor Details

    • ReportKey

      public ReportKey(ReportMeta meta, Class<T> clazz, boolean isGeneralInterest)
      Constructor.
      Parameters:
      meta - metadata describing this key
      clazz - type of data item described by this key
      isGeneralInterest - indicates whether this key represents a general purpose report
  • Method Details

    • getMeta

      public ReportMeta getMeta()
      Returns this key's metadata.
      Returns:
      descriptive metadata
    • getValueClass

      public Class<T> getValueClass()
      Returns the type of object identified by this key.
      Returns:
      value class
    • isGeneralInterest

      public boolean isGeneralInterest()
      Indicates whether this key represents a key of general interest. General interest reports can/should be presented to the user by a general purpose UI as plot feedback and the corresponding values should have a sensible toString implemenatation. If the return value is false, the corresponding report is only intended for plotter-specific code that understands what it's getting.
      Returns:
      true if general purpose code should present report items to the user in their stringified form
    • toText

      public abstract String toText(T value)
      Serializes a value associated with this key in a way that can be presented to a human user.
      Parameters:
      value - value for this key
      Returns:
      short text representation
    • createStringKey

      public static ReportKey<String> createStringKey(ReportMeta meta, boolean isGeneralInterest)
      Constructs a string-valued key.
      Parameters:
      meta - metadata describing the key
      isGeneralInterest - indicates whether the key represents a general purpose report
      Returns:
      new key
    • createDoubleKey

      public static ReportKey<Double> createDoubleKey(ReportMeta meta, boolean isGeneralInterest)
      Constructs a double-precision-valued key.
      Parameters:
      meta - metadata describing the key
      isGeneralInterest - indicates whether the key represents a general purpose report
      Returns:
      new key
    • createIntegerKey

      public static ReportKey<Integer> createIntegerKey(ReportMeta meta, boolean isGeneralInterest)
      Constructs an integer-valued key.
      Parameters:
      meta - metadata describing the key
      isGeneralInterest - indicates whether the key represents a general purpose report
      Returns:
      new key
    • createObjectKey

      public static <T> ReportKey<T> createObjectKey(ReportMeta meta, Class<T> clazz, boolean isGeneralInterest)
      Constructs a typed key with default stringification.
      Parameters:
      meta - metadata describing this key
      clazz - type of data item described by this key
      isGeneralInterest - indicates whether this key represents a general purpose report
      Returns:
      new report key
    • createTableKey

      public static ReportKey<uk.ac.starlink.table.StarTable> createTableKey(ReportMeta meta, boolean isGeneralInterest)
      Constructs a StarTable-valued key.
      Parameters:
      meta - metadata describing the key
      isGeneralInterest - indicates whether the key represents a general purpose report
      Returns:
      new key
    • createUnprintableKey

      public static <T> ReportKey<T> createUnprintableKey(ReportMeta meta, Class<T> clazz)
      Constructs a non-general-interest key with no useful text serialization.
      Parameters:
      meta - metadata describing the key
      clazz - type of data item described by this key
      Returns:
      new key