aem-plugin / com.cognifide.gradle.aem.common.utils / Formats

Formats

object Formats

Properties

URL_VALIDATOR

val URL_VALIDATOR: UrlValidator

VERSION_UNKNOWN

val VERSION_UNKNOWN: GradleVersion!

Functions

asJson

fun asJson(input: InputStream): DocumentContext!
fun asJson(value: String): DocumentContext!

asPassword

fun asPassword(value: String): String

asVersion

Trims e.g ".SP2" in "6.1.0.SP2" which is not valid Gradle version

fun asVersion(value: String): GradleVersion

bytesToHuman

fun bytesToHuman(bytes: Long): String

calculateChecksum

fun calculateChecksum(text: String): String

commandToArgs

Splits command to arguments usually delimited by space while considering quoted string containing spaces as single argument.

fun commandToArgs(command: String): List<String>

date

fun date(date: Date = Date()): String

dateFileName

fun dateFileName(date: Date = Date()): String

dateTime

fun dateTime(timestamp: Long, zoneId: ZoneId): LocalDateTime

dateToCalendar

fun dateToCalendar(date: Date): Calendar

duration

fun duration(millis: Long): String

durationFit

fun durationFit(thenMillis: Long, thenZoneId: ZoneId, durationMillis: Long): Boolean

durationSince

fun durationSince(millis: Long): String

fromJson

fun <T : Any> fromJson(json: String): T
fun <T> fromJson(json: String, clazz: Class<T>): T

fromJsonToMap

fun fromJsonToMap(json: String): Map<String, Any?>

jsonMapper

fun jsonMapper(pretty: Boolean): ObjectMapper

manglePath

Converts e.g ':jcr:content' to '_jcr_content' (part of JCR path to be valid OS path).

fun manglePath(path: String): String

noLineBreaks

fun noLineBreaks(text: String): String

normalizePath

fun normalizePath(path: String): String

normalizeSeparators

fun normalizeSeparators(name: String, separator: String): String

percent

fun percent(current: Int, total: Int): String
fun percent(current: Long, total: Long): String

percentExplained

fun percentExplained(current: Int, total: Int): String
fun percentExplained(current: Long, total: Long): String

projectPath

fun projectPath(file: File, project: Project): String
fun projectPath(path: String, project: Project): String

relativePath

fun relativePath(path: String, basePath: String): String

rootProjectPath

fun rootProjectPath(file: File, project: Project): String
fun rootProjectPath(path: String, project: Project): String

size

fun size(file: File): String

timestamp

fun timestamp(): String

toBase64

fun toBase64(value: String): String

toJson

fun toJson(value: Any, pretty: Boolean = true): String
fun toJson(value: Map<String, Any?>, pretty: Boolean = true): String

toList

fun toList(value: String?, delimiter: String = ","): List<String>?

toMap

fun toMap(value: String?, valueDelimiter: String = ",", keyDelimiter: String = "="): Map<String, String>?

versionAtLeast

fun versionAtLeast(actual: String, required: String): Boolean