Index
//hexagon_core/com.hexagonkt.helpers
Package com.hexagonkt.helpers¶
[jvm]
JVM information, a logger class and other useful utilities.
Types¶
Name | Summary |
---|---|
Ansi | [jvm] Content object Ansi More info Constants for console formatting with ANSI codes. |
CodedException | [jvm] Content class CodedException(code: Int, message: String, cause: Throwable?) : RuntimeException More info Exception with a numeric code. |
Jvm | [jvm] Content object Jvm More info Object with utilities to gather information about the running JVM. |
MultipleException | [jvm] Content class MultipleException(causes: List<Throwable>, message: String) : RuntimeException More info Exception with a list of causes. |
Functions¶
Name | Summary |
---|---|
banner | [jvm] Content fun String.banner(bannerDelimiter: String = "*"): String More info Format the string as a banner with a delimiter above and below text. |
bytes | [jvm] Content fun UUID.bytes(): ByteArray More info TODO. |
camelToSnake | [jvm] Content fun String.camelToSnake(): String More info Transform the target string from camel case to snake case. |
check | [jvm] Content fun check(message: String = "Multiple exceptions", vararg blocks: () -> Unit) More info TODO. |
ensureSize | [jvm] Content fun <Z> Collection<Z>.ensureSize(count: IntRange): Collection<Z> More info TODO. |
exec | [jvm] Content fun String.exec(workingDirectory: File = File(System.getProperty("user.dir")), timeout: Long = Long.MAX_VALUE, fail: Boolean = false): String More info TODO Add use case and example in documentation. [jvm] Content fun List<String>.exec(workingDirectory: File = File(System.getProperty("user.dir")), timeout: Long = Long.MAX_VALUE, fail: Boolean = false): String More info TODO. |
filter | [jvm] Content fun String.filter(prefix: String, suffix: String, vararg parameters: Pair<String, String>): String More info TODO. |
filterEmpty | [jvm] Content fun <V> List<V?>.filterEmpty(): List<V> fun <K, V> Map<K, V?>.filterEmpty(): Map<K, V> More info TODO. |
filterStackTrace | [jvm] Content fun Throwable.filterStackTrace(prefix: String): Array More info Return the stack trace array of the frames that starts with the given prefix. |
filterVars | [jvm] Content fun String.filterVars(vararg parameters: Pair<, >): String More info TODO. [jvm] Content fun String.filterVars(parameters: Map<, >): String More info Filter the target string substituting each key by its value. |
findGroups | [jvm] Content fun Regex.findGroups(text: String): List<MatchGroup> More info TODO. |
freePort | [jvm] Content fun freePort(): Int More info Return a random free port (not used by any other local process). |
get | [jvm] Content operator fun Map<, >.get(vararg keys: Any): Any? More info TODO. |
globToRegex | [jvm] Content fun String.globToRegex(): Regex More info TODO. |
isPortOpened | [jvm] Content fun isPortOpened(port: Int): Boolean More info Check if a port is already opened. |
notEmpty | [jvm] Content fun <V> notEmpty(value: V?): Boolean More info TODO. |
prependIndent | [jvm] Content fun String.prependIndent(count: Int = 4, pad: String = " "): String More info TODO. |
println | [jvm] Content fun <T> T.println(prefix: String = ""): T More info Print receiver to stdout. |
require | [jvm] Content fun <K, V> Map<K, V>.require(name: K): V More info TODO. |
requireKeys | [jvm] Content fun <T : Any> Map<, >.requireKeys(vararg name: Any): T More info TODO. |
retry | [jvm] Content fun <T> retry(times: Int, delay: Long, block: () -> T): T More info Execute a lambda until no exception is thrown or a number of times is reached. |
snakeToCamel | [jvm] Content fun String.snakeToCamel(): String More info Transform the target string from snake case to camel case. |
stripAccents | [jvm] Content fun String.stripAccents(): String More info TODO. |
toBase64 | [jvm] Content fun UUID.toBase64(): String More info TODO. |
toDate | [jvm] Content fun LocalDate.toDate(): Date More info Convert a local date to a date. [jvm] Content fun LocalDateTime.toDate(): Date More info Convert a local date time to a date. [jvm] Content fun ZonedDateTime.toDate(): Date More info Convert a zoned date time to a date. |
toLocalDate | [jvm] Content fun Date.toLocalDate(): LocalDate More info Convert a date to a local date. [jvm] Content fun Int.toLocalDate(): LocalDate More info Parse a date from a formatted integer with this format: YYYYMMDD. |
toLocalDateTime | [jvm] Content fun Date.toLocalDateTime(): LocalDateTime More info Convert a date to a local date time. [jvm] Content fun Long.toLocalDateTime(): LocalDateTime More info Parse a date time from a formatted number with this format: YYYYMMDDHHmmss. |
toLocalTime | [jvm] Content fun Int.toLocalTime(): LocalTime More info Parse a time from a formatted integer with this format: HHmmssSSS. |
toNumber | [jvm] Content fun LocalDate.toNumber(): Int More info Convert a date to an integer with the following format: YYYYMMDD. [jvm] Content fun LocalDateTime.toNumber(): Long More info Convert a date time to a number with the following format: YYYYMMDDHHmmss. [jvm] Content fun LocalTime.toNumber(): Int More info Convert a time to an integer with the following format: HHmmssSSS. |
toStream | [jvm] Content fun String.toStream(): InputStream More info TODO. |
toText | [jvm] Content fun Throwable.toText(prefix: String = ""): String More info Return this throwable as a text. |
trace | [jvm] Content fun <T> T.trace(prefix: String = ""): T More info TODO. |
utf8 | [jvm] Content fun utf8(vararg bytes: Int): String More info TODO. |
uuid | [jvm] Content fun uuid(bytes: ByteArray): UUID fun uuid(text: String): UUID More info TODO. |
withZone | [jvm] Content fun LocalDateTime.withZone(zoneId: ZoneId = Jvm.timeZone.toZoneId()): ZonedDateTime More info Return the date time in a given time zone for a local date time. |
Properties¶
Name | Summary |
---|---|
eol | [jvm] val eol: StringRuntime specific end of line. |
fail | [jvm] val fail: NothingSyntax sugar to throw errors. |
logger | [jvm] val logger: LoggerDefault logger for when you feel too lazy to declare one. |