Package-level declarations

Utilities to check fields, run programs or shell command, I18n, etc.

Types

Link copied to clipboard
abstract class MapResourceBundle(val map: Map<*, *>) : ListResourceBundle

.

Properties

Link copied to clipboard

Set of allowed country codes in this JVM.

Link copied to clipboard

Set of allowed currency codes in this JVM.

Link copied to clipboard

Set of allowed language codes in this JVM.

Functions

Link copied to clipboard
Link copied to clipboard
fun check(message: String, vararg blocks: () -> Unit)

Execute a list of code block collecting the exceptions they may throw, in case there is any error, it throws a MultipleException with all the thrown exceptions.

Link copied to clipboard

Ensure a collection has a fixed number of elements.

Link copied to clipboard
fun countryOf(country: String): Locale
Link copied to clipboard
fun countryOfOrNull(country: String): Locale?
Link copied to clipboard
fun String.exec(workingDirectory: File = File(System.getProperty("user.dir")), timeout: Long = Long.MAX_VALUE, fail: Boolean = false): String

TODO Add use case and example in documentation.

fun List<String>.exec(workingDirectory: File = File(System.getProperty("user.dir")), timeout: Long = Long.MAX_VALUE, fail: Boolean = true): String

.

Link copied to clipboard
fun languageOf(language: String): Locale
Link copied to clipboard
fun languageOfOrNull(language: String): Locale?
Link copied to clipboard
fun localeOf(language: String = "", country: String = ""): Locale

.

Link copied to clipboard
fun localeOfOrNull(language: String = "", country: String = ""): Locale?

.

Link copied to clipboard
fun parseLocale(languageCountry: String): Locale
Link copied to clipboard
fun parseLocaleOrNull(languageCountry: String): Locale?
Link copied to clipboard

Load a '*.properties' file from a URL transforming the content into a plain map. If the resource can not be found, a com.hexagontk.core.ResourceNotFoundException is thrown.

Link copied to clipboard
fun <T : Any, N> T.requireGreater(field: KProperty1<T, Comparable<N>?>, min: N)
fun <T : Any, N> T.requireGreater(field: KProperty1<T, Comparable<N>?>, field2: KProperty1<T, N?>)
Link copied to clipboard
fun <T : Any, N> T.requireGreaterOrEquals(field: KProperty1<T, Comparable<N>?>, min: N)
fun <T : Any, N> T.requireGreaterOrEquals(field: KProperty1<T, Comparable<N>?>, field2: KProperty1<T, N?>)
Link copied to clipboard
fun <T : Any, N> T.requireLower(field: KProperty1<T, Comparable<N>?>, min: N)
fun <T : Any, N> T.requireLower(field: KProperty1<T, Comparable<N>?>, field2: KProperty1<T, N?>)
Link copied to clipboard
fun <T : Any, N> T.requireLowerOrEquals(field: KProperty1<T, Comparable<N>?>, min: N)
fun <T : Any, N> T.requireLowerOrEquals(field: KProperty1<T, Comparable<N>?>, field2: KProperty1<T, N?>)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <T : ResourceBundle> resourceBundle(locale: Locale = Locale.getDefault()): ResourceBundle
fun <T : ResourceBundle> resourceBundle(type: KClass<T>, locale: Locale = Locale.getDefault()): ResourceBundle

.

Link copied to clipboard
fun <T> retry(times: Int, delay: Long, block: () -> T): T

Execute a lambda until no exception is thrown or a number of times is reached.

Link copied to clipboard
fun String.shell(workingDirectory: File = File(System.getProperty("user.dir")), timeout: Long = Long.MAX_VALUE, fail: Boolean = false): String

Executes a command in a shell (allowing to use pipes, redirections, etc.).

Link copied to clipboard
Link copied to clipboard
fun uuid(bytes: ByteArray): UUID
fun uuid(text: String): UUID

.