public class Args
extends java.util.LinkedHashMap<java.lang.String,java.lang.Object>
Args
class is a helper class for working with Splunk REST API
arguments.
This extension is used mainly for encoding arguments for UTF8 transmission
to a Splunk instance in a key=value pairing for a string, or
key=value1&key=value2 (and so on) for an array of strings.Constructor and Description |
---|
Args()
Class constructor.
|
Args(java.util.Map<java.lang.String,java.lang.Object> values)
Class constructor.
|
Args(java.lang.String key,
java.lang.Object value)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
Args |
add(java.lang.String key,
java.lang.Object value)
Adds an argument to an
Args object. |
static Args |
create()
Creates a new empty instance of
Args . |
static Args |
create(java.util.Map<java.lang.String,java.lang.Object> values)
Creates a new
Args instance and initializes it with a
pre-existing hash map. |
static Args |
create(java.lang.String key,
java.lang.Object value)
Creates a new
Args instance and initializes it with a single
key-value pair. |
java.lang.String |
encode()
Encodes an
Args instance into a UTF8-encoded string. |
static java.lang.String |
encode(java.util.Map<java.lang.String,java.lang.Object> args)
Encodes a hash map of
String:String or String:String[]
into a single UTF8-encoded string. |
static java.lang.String |
encode(java.lang.String value)
Encodes a single string with UTF8 encoding.
|
static <T> T |
get(java.util.Map<java.lang.String,java.lang.Object> args,
java.lang.String key,
T defaultValue)
Returns the hash-map value of a specific key, or the default value if
the key is not found.
|
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
public Args()
public Args(java.lang.String key, java.lang.Object value)
key
- The key name.value
- The value, as a String:String
or
String:String[]
.public Args(java.util.Map<java.lang.String,java.lang.Object> values)
values
- A set of key-value pairs.public Args add(java.lang.String key, java.lang.Object value)
Args
object.key
- The key name.value
- The value, as a String:String
or
String:String[]
.Args
set.public static Args create()
Args
.Args
instance.public static Args create(java.lang.String key, java.lang.Object value)
Args
instance and initializes it with a single
key-value pair.key
- The key name.value
- The value, as a String:String
or
String:String[]
.Args
instance.public static Args create(java.util.Map<java.lang.String,java.lang.Object> values)
Args
instance and initializes it with a
pre-existing hash map.values
- The pre-existing hash map.Args
instance.public static java.lang.String encode(java.lang.String value)
value
- The string.public static java.lang.String encode(java.util.Map<java.lang.String,java.lang.Object> args)
String:String
or String:String[]
into a single UTF8-encoded string.args
- The hash map.public java.lang.String encode()
Args
instance into a UTF8-encoded string.public static <T> T get(java.util.Map<java.lang.String,java.lang.Object> args, java.lang.String key, T defaultValue)
T
- The class type.args
- The hash map.key
- The key to look for.defaultValue
- The default value, if the key is not found.