Keywords

The class Keywords is a helper for supporting named optional method arguments. These arguments are handled like an array of arguments with the difference that each argument is named and may or may not be provided in a concrete method call.

Constructors

Link copied to clipboard
constructor()

Constructs a empty set of Pair using the two given objects as head and tail.

constructor(vararg keywords: Any?)

Constructs a Keywords with an unlimited number of arguments.

constructor(originalKeywords: Keywords, vararg keywords: Any?)

Constructs a Keywords based upon a given keyword list.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var size: Int

return the size of this instance which includes both keys and values.

Functions

Link copied to clipboard
fun add(keywords: Keywords): Keywords

add all keys of the specified Keywords arguments to this instance possibly overwriting existing entries.

Link copied to clipboard
fun addValue(keyword: String?, value: Any?)

Adds the given value with the given name to the keyword arguments. If a keyword argument with the given name is already known, its value is changed. This method and setValue are effectively identical.

Link copied to clipboard
open override fun clone(): Keywords
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun getValue(keyword: String): Any?
fun <T> getValue(keyword: String, clazz: Class<T>): T

Returns the value of a named keyword argument using null as the default value that is returned, if this argument is unknown.

fun <T> getValue(keyword: String, defaultValue: T): T
fun <T> getValue(keyword: String, clazz: Class<T>, defaultValue: T): T

Returns the value of a named keyword argument. The given default value is returned, if this argument is unknown.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun hasValue(keyword: String): Boolean

Returns true, if the given keyword argument has a known value.

Link copied to clipboard
open override fun readExternal(in: ObjectInput)
Link copied to clipboard
open fun removeValue(keyword: String?)

Removes the keyword argument with the given name.

Link copied to clipboard
open fun setValue(keyword: String?, value: Any?)

Adds the given value with the given name to the keyword arguments. If a keyword argument with the given name is already known, its value is changed. This method and addValue are effectively identical.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open override fun writeExternal(out: ObjectOutput)