Class ArgumentInfo


public final class ArgumentInfo extends PMap.MapBasedValue
Info object used to define the valid input and output arguments of a Control.

As well as giving the type of the argument, an ArgumentInfo can have an optional set of properties. This might be used for defining the "minimum" and "maximum" values of a PNumber argument, for example.

  • Field Details

    • TYPE_NAME

      public static final String TYPE_NAME
      Value type name.
      See Also:
    • KEY_TYPE

      public static final String KEY_TYPE
      Map key for Value type name. The map value should be the String from Value.Type.name().
      See Also:
    • KEY_ALLOWED_VALUES

      public static final String KEY_ALLOWED_VALUES
      Map key for optional list of allowed values.
      See Also:
    • KEY_SUGGESTED_VALUES

      public static final String KEY_SUGGESTED_VALUES
      Map key for optional list of suggested values. A user interface may show these as values to select, but must also allow other values to be entered.
      See Also:
    • KEY_ALLOW_EMPTY

      public static final String KEY_ALLOW_EMPTY
      Map key for optional flag that an empty value will be accepted even when the type has no empty representation.
      See Also:
    • KEY_EMPTY_IS_DEFAULT

      public static final String KEY_EMPTY_IS_DEFAULT
      Map key for optional flag that an empty value will be treated as a default.
      See Also:
    • KEY_TEMPLATE

      public static final String KEY_TEMPLATE
      Map key for optional text template. A user interface might show the template when the value is otherwise empty.
      See Also:
    • KEY_MIME_TYPE

      public static final String KEY_MIME_TYPE
      Map key for optional mime type of the value.
      See Also:
    • KEY_OPTIONAL

      public static final String KEY_OPTIONAL
      Map key to mark an argument as optional. The value may be omitted in input arguments or not returned in outputs arguments.
      See Also:
    • KEY_VARARGS

      public static final String KEY_VARARGS
      Map key to mark an argument as varargs. The input or output arguments may include any number of matching values.
      See Also:
  • Method Details

    • argumentType

      public String argumentType()
      The value type name of the argument. See Value.Type.name().
      Returns:
      value type name
    • properties

      public PMap properties()
      Access the map of properties. The map includes the value type, as well as any custom or optional properties.

      This method is equivalent to calling PMap.MapBasedValue.dataMap().

      Returns:
      property map
    • of

      public static ArgumentInfo of(Class<? extends Value> argClass)
      Create an ArgumentInfo from the Value class and optional PMap of additional properties.
      Parameters:
      argClass -
      Returns:
      ArgumentInfo
    • of

      public static ArgumentInfo of(Class<? extends Value> argClass, PMap properties)
      Create an ArgumentInfo from the Value class and optional PMap of additional properties.
      Parameters:
      argClass -
      properties -
      Returns:
      ArgumentInfo
    • from

      public static Optional<ArgumentInfo> from(Value arg)
      Coerce the provided Value into an ArgumentInfo if possible.
      Parameters:
      arg - value of unknown type
      Returns:
      argument info or empty optional
    • parse

      public static ArgumentInfo parse(String string) throws ValueFormatException
      Parse the provided String into an ArgumentInfo if possible.
      Parameters:
      string - text to parse
      Returns:
      argument info
      Throws:
      ValueFormatException - if parsing fails