Class ActionArgs.ParsedArgs

java.lang.Object
com.scivicslab.pojoactor.core.ActionArgs.ParsedArgs
Enclosing class:
ActionArgs

public static class ActionArgs.ParsedArgs extends Object
Unified accessor for action arguments.

Provides consistent access to arguments regardless of whether they came from array format or object format in YAML.

  • Method Summary

    Modifier and Type
    Method
    Description
    org.json.JSONArray
    Gets the underlying JSONArray (for array format).
    org.json.JSONObject
    Gets the underlying JSONObject (for object format).
    get(int index)
    Gets string at index (for array format).
    get(int index, String defaultValue)
    Gets string at index with default (for array format).
    get(String key)
    Gets string by key (for object format).
    get(String key, String defaultValue)
    Gets string by key with default (for object format).
    boolean
    getBoolean(int index)
    Gets boolean at index (for array format).
    boolean
    getBoolean(int index, boolean defaultValue)
    Gets boolean at index with default (for array format).
    boolean
    Gets boolean by key (for object format).
    boolean
    getBoolean(String key, boolean defaultValue)
    Gets boolean by key with default (for object format).
    int
    getInt(int index)
    Gets integer at index (for array format).
    int
    getInt(int index, int defaultValue)
    Gets integer at index with default (for array format).
    int
    Gets integer by key (for object format).
    int
    getInt(String key, int defaultValue)
    Gets integer by key with default (for object format).
    boolean
    has(String key)
    Checks if key exists (for object format).
    boolean
    Checks if arguments are in array format.
    boolean
    Checks if arguments are empty.
    boolean
    Checks if arguments are in object format.
    int
    Gets the number of elements (for array format).
    raw()
    Gets the raw JSON string.

    Methods inherited from class java.lang.Object

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

    • raw

      public String raw()
      Gets the raw JSON string.
      Returns:
      the original args string
    • isArray

      public boolean isArray()
      Checks if arguments are in array format.
      Returns:
      true if array format
    • isObject

      public boolean isObject()
      Checks if arguments are in object format.
      Returns:
      true if object format
    • length

      public int length()
      Gets the number of elements (for array format).
      Returns:
      array length, or 0 if not array format
    • isEmpty

      public boolean isEmpty()
      Checks if arguments are empty.
      Returns:
      true if empty
    • get

      public String get(int index)
      Gets string at index (for array format).
      Parameters:
      index - 0-based index
      Returns:
      string value, or empty string if not found
    • get

      public String get(int index, String defaultValue)
      Gets string at index with default (for array format).
      Parameters:
      index - 0-based index
      defaultValue - default if not found
      Returns:
      string value
    • getInt

      public int getInt(int index)
      Gets integer at index (for array format).
      Parameters:
      index - 0-based index
      Returns:
      int value, or 0 if not found
    • getInt

      public int getInt(int index, int defaultValue)
      Gets integer at index with default (for array format).
      Parameters:
      index - 0-based index
      defaultValue - default if not found
      Returns:
      int value
    • getBoolean

      public boolean getBoolean(int index)
      Gets boolean at index (for array format).
      Parameters:
      index - 0-based index
      Returns:
      boolean value, or false if not found
    • getBoolean

      public boolean getBoolean(int index, boolean defaultValue)
      Gets boolean at index with default (for array format).
      Parameters:
      index - 0-based index
      defaultValue - default if not found
      Returns:
      boolean value
    • get

      public String get(String key)
      Gets string by key (for object format).
      Parameters:
      key - key name
      Returns:
      string value, or empty string if not found
    • get

      public String get(String key, String defaultValue)
      Gets string by key with default (for object format).
      Parameters:
      key - key name
      defaultValue - default if not found
      Returns:
      string value
    • getInt

      public int getInt(String key)
      Gets integer by key (for object format).
      Parameters:
      key - key name
      Returns:
      int value, or 0 if not found
    • getInt

      public int getInt(String key, int defaultValue)
      Gets integer by key with default (for object format).
      Parameters:
      key - key name
      defaultValue - default if not found
      Returns:
      int value
    • getBoolean

      public boolean getBoolean(String key)
      Gets boolean by key (for object format).
      Parameters:
      key - key name
      Returns:
      boolean value, or false if not found
    • getBoolean

      public boolean getBoolean(String key, boolean defaultValue)
      Gets boolean by key with default (for object format).
      Parameters:
      key - key name
      defaultValue - default if not found
      Returns:
      boolean value
    • has

      public boolean has(String key)
      Checks if key exists (for object format).
      Parameters:
      key - key name
      Returns:
      true if key exists
    • asArray

      public org.json.JSONArray asArray()
      Gets the underlying JSONArray (for array format).
      Returns:
      JSONArray, or null if not array format
    • asObject

      public org.json.JSONObject asObject()
      Gets the underlying JSONObject (for object format).
      Returns:
      JSONObject, or null if not object format