Class IndicatorMeta

java.lang.Object
com.wualabs.qtsurfer.engine.indicators.core.IndicatorMeta

public final class IndicatorMeta extends Object
Descriptive metadata an indicator carries about itself, kept separate from its registered name .

Everything that used to be smuggled into the name — the "%" display suffix, the Upper/Lower/BW band suffixes, the rsi/dist/chg prefixes and the parameter digits — is carried here as small key=value entries instead, so a stored column like blgr13_2Upper is decodable without insider knowledge of the naming convention: id=bollinger, periods=13, k=2, band=upper.

Wire-compact from birth. The frame keys (ID, DISPLAY, SOURCE, NAME) use their short serialized spelling directly — what is in memory is what lands as per-column metadata in the storage layer (lastra) with no mapping layer to drift. Parameter keys (periods, k, band, …) deliberately keep their natural names: they are the same identifiers the strategy-IR catalog uses, and that convergence matters more than a few bytes.

Write-only descriptor, never configuration. Indicators must never read their own metadata to drive a computation — it describes what was built, it does not parameterize it. A value read back into the math would turn this into a second, undeclared configuration system.

  • Field Details

    • ID

      public static final String ID
      Canonical indicator type id — the strategy-IR catalog vocabulary (bollinger, rsi, …). An explicit override: it is set only when RTIndicator.getId()'s class-name derivation would be wrong (a renamed type, or an instance registered wrapped in a generic decorator). Read it through getId(), which falls back to the derivation — not from the map directly, or a derived id looks absent.
      See Also:
    • DISPLAY

      public static final String DISPLAY
      Display hint wire key. Values are DisplayHint codes (P, V); an absent entry means DisplayHint.ABSOLUTE, so the default costs no bytes.
      See Also:
    • SOURCE

      public static final String SOURCE
      The indicator another one derives from (distanceMa, percentChange, bandwidth…).
      See Also:
    • NAME

      public static final String NAME
      Optional user-facing label (Bol1), distinct from the lookup name.
      See Also:
    • VISIBILITY

      public static final String VISIBILITY
      Visibility wire key. Its only non-default value is HIDDEN; an absent entry means public (emitted), so the common case costs no bytes. Replaces reading the "_" name prefix at the emission/storage boundary.
      See Also:
    • HIDDEN

      public static final String HIDDEN
      VISIBILITY value for an internal indicator: updated, but its value is not emitted.
      See Also:
    • EMPTY

      public static final IndicatorMeta EMPTY
      The shared immutable empty metadata, returned by indicators that carry none. Mutators throw.
  • Constructor Details

    • IndicatorMeta

      public IndicatorMeta()
  • Method Details

    • put

      public IndicatorMeta put(@NonNull @NonNull String key, @NonNull @NonNull Object value)
      Sets one metadata entry. The value is stored as its string form — this map is the wire form.
      Parameters:
      key - the entry key (a frame-key constant, or a natural parameter name)
      value - the value; stored via String.valueOf(Object)
      Returns:
      this metadata, for chaining
    • get

      public String get(String key)
    • isEmpty

      public boolean isEmpty()
    • asMap

      public Map<String,String> asMap()
      The entries as an unmodifiable, insertion-ordered map — ready for per-column serialization.
    • displayHint

      public DisplayHint displayHint()
      The typed view of the DISPLAY entry; absent = DisplayHint.ABSOLUTE.
    • isHidden

      public boolean isHidden()
      Whether this describes an internal indicator that is updated but not emitted (default false).
    • hidden

      public IndicatorMeta hidden(boolean hidden)
      Sets VISIBILITY; false (public) removes the entry — the default is absence.
    • displayHint

      public IndicatorMeta displayHint(DisplayHint displayHint)
      Sets the DISPLAY entry from its typed form. DisplayHint.ABSOLUTE (or null) removes the entry — the default is expressed by absence.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • deriveId

      public static String deriveId(Class<?> type)
      Derives a canonical id from an indicator class name: strip the RTIndicator suffix and lower-case the first letter — RsiRTIndicator"rsi", SumRTIndicator"sum". This is the default RTIndicator.getId() returns; a class whose canonical id differs from its name (e.g. BollingerBandsRTIndicator"bollinger"), or an instance registered wrapped in a generic decorator, carries an explicit ID entry that wins over this.
      Parameters:
      type - the indicator's runtime class
      Returns:
      the derived id