Class Watch

java.lang.Object
org.praxislive.core.Watch

public final class Watch extends Object
Utilities related to Watch controls. A Watch control is a ControlInfo.Type.Function control for accessing data of a component. It is similar to a read-only property, but designed for data that should only be calculated on demand, perhaps asynchronously.

Watch controls have a watch attribute in their info, with a map value of information about the available data. The map should include the mime type of the returned data. The response value type of the control will usually be

invalid reference
PString
for textual mime types and
invalid reference
PBytes
for binary mime types. Specifically defined private mime types may specify other value types.

Watch controls may accept an optional query argument as a map of attributes for the requested data (eg. size).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The key for the mime type inside the Watch information.
    static final String
    Optional Watch information key for relating a Watch to a port.
    static final String
    The key under which the Watch information is stored in the control info.
  • Method Summary

    Modifier and Type
    Method
    Description
    info(String mimeType, Class<? extends Value> responseType)
    Create info for a simple Watch function that accepts no query argument, and returns data with the provided mime type wrapped in the provided response type.
    static boolean
    Check whether a control info reflects a Watch control.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • WATCH_KEY

      public static final String WATCH_KEY
      The key under which the Watch information is stored in the control info.
      See Also:
    • MIME_KEY

      public static final String MIME_KEY
      The key for the mime type inside the Watch information.
      See Also:
  • Method Details

    • info

      public static ControlInfo info(String mimeType, Class<? extends Value> responseType)
      Create info for a simple Watch function that accepts no query argument, and returns data with the provided mime type wrapped in the provided response type.
      Parameters:
      mimeType - mime type of response
      responseType - value type of response
      Returns:
      watch control info
    • isWatch

      public static boolean isWatch(ControlInfo info)
      Check whether a control info reflects a Watch control.
      Parameters:
      info - control info
      Returns:
      true if a Watch control