NamedKernelParameter

abstract class NamedKernelParameter<T : Any>(val aliases: List<String>) : KernelParameter<T>

Abstract base class for named kernel parameters that follow the format "-name=value". Provides a common implementation for parsing and serializing named parameters.

Parameters

T

The type of value that this parameter represents

Inheritors

Constructors

Link copied to clipboard
constructor(aliases: List<String>)

Properties

Link copied to clipboard

List of alternative names for this parameter

Functions

Link copied to clipboard
abstract fun parseValue(argValue: String, previousValue: T?): T

Parses a string value into a value of type T. This method is called after the parameter name has been matched and the value extracted.

Link copied to clipboard
open override fun serialize(value: T): String?

Serializes a value to a command-line argument with the parameter's primary alias.

Link copied to clipboard
abstract fun serializeValue(value: T): String?

Serializes a value of type T to a string representation (without the parameter name prefix).

Link copied to clipboard
open override fun tryParse(arg: String, previousValue: T?): T?

Attempts to parse a command-line argument if it matches one of this parameter's aliases. Checks if the argument starts with "-alias=" for any of the aliases.