Package uk.ac.starlink.ttools.plot2
Class ReportKey<T>
java.lang.Object
uk.ac.starlink.ttools.plot2.ReportKey<T>
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 Summary
ConstructorsConstructorDescriptionReportKey
(ReportMeta meta, Class<T> clazz, boolean isGeneralInterest) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncreateDoubleKey
(ReportMeta meta, boolean isGeneralInterest) Constructs a double-precision-valued key.createIntegerKey
(ReportMeta meta, boolean isGeneralInterest) Constructs an integer-valued key.static <T> ReportKey<T>
createObjectKey
(ReportMeta meta, Class<T> clazz, boolean isGeneralInterest) Constructs a typed key with default stringification.createStringKey
(ReportMeta meta, boolean isGeneralInterest) Constructs a string-valued key.static ReportKey<uk.ac.starlink.table.StarTable>
createTableKey
(ReportMeta meta, boolean isGeneralInterest) Constructs a StarTable-valued key.static <T> ReportKey<T>
createUnprintableKey
(ReportMeta meta, Class<T> clazz) Constructs a non-general-interest key with no useful text serialization.getMeta()
Returns this key's metadata.Returns the type of object identified by this key.boolean
Indicates whether this key represents a key of general interest.abstract String
Serializes a value associated with this key in a way that can be presented to a human user.
-
Constructor Details
-
ReportKey
Constructor.- Parameters:
meta
- metadata describing this keyclazz
- type of data item described by this keyisGeneralInterest
- indicates whether this key represents a general purpose report
-
-
Method Details
-
getMeta
Returns this key's metadata.- Returns:
- descriptive metadata
-
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
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
Constructs a string-valued key.- Parameters:
meta
- metadata describing the keyisGeneralInterest
- indicates whether the key represents a general purpose report- Returns:
- new key
-
createDoubleKey
Constructs a double-precision-valued key.- Parameters:
meta
- metadata describing the keyisGeneralInterest
- indicates whether the key represents a general purpose report- Returns:
- new key
-
createIntegerKey
Constructs an integer-valued key.- Parameters:
meta
- metadata describing the keyisGeneralInterest
- 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 keyclazz
- type of data item described by this keyisGeneralInterest
- 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 keyisGeneralInterest
- indicates whether the key represents a general purpose report- Returns:
- new key
-
createUnprintableKey
Constructs a non-general-interest key with no useful text serialization.- Parameters:
meta
- metadata describing the keyclazz
- type of data item described by this key- Returns:
- new key
-