vertx / io.vertx.core.cli.converters / FromStringBasedConverter

FromStringBasedConverter

class FromStringBasedConverter<T : Any> : Converter<T>

This 'default' converter tries to create objects using a static 'from' method taking a single String argument. This converter is particularly convenient for converters themselves.

Author
Clement Escoffier

Properties

FROM_STRING

static val FROM_STRING: String

Functions

fromString

fun fromString(input: String): T

Converts the given input to an object by using the 'fromString' method. Notice that the method may receive a null value.

getIfEligible

static fun <T : Any> getIfEligible(clazz: Class<T>): FromStringBasedConverter<T>

Checks whether the given class can be used by the FromStringBasedConverter (i.e. has a static 'fromString' method taking a single String as argument). If so, creates a new instance of converter for this type.