Package-level declarations

Types

Link copied to clipboard
sealed interface KbEnvironment

Represents the environment (variable bindings and context) used when rendering a KbTemplate.

Link copied to clipboard
abstract class KbEnvironmentBuilder

DSL receiver passed to the configure lambda of KbEnvironment.create for registering transforms and properties on the environment under construction.

Link copied to clipboard
abstract class KbEventListener

A caller-supplied observer that is notified of soft failures during a KbTemplate render.

Link copied to clipboard
abstract class KbException(cause: Throwable, val location: KbSourceLocation? = null, val errorCode: String = "KB-0000") : RuntimeException

Base class for all kBars runtime exceptions.

Link copied to clipboard
class KbParseException(cause: Throwable, location: KbSourceLocation? = null, errorCode: String = "KB-0000") : KbException

Thrown by KbTemplate.render when the template source cannot be parsed.

Link copied to clipboard
fun interface KbPartialLoader

A caller-supplied loader that resolves a partial key to the KbTemplate to render in place of a {{> key }} tag.

Link copied to clipboard
class KbRenderException(cause: Throwable, location: KbSourceLocation? = null, errorCode: String = "KB-0000") : KbException

Thrown by KbTemplate.render when the template source parses successfully but a fatal error occurs at render time.

Link copied to clipboard
class KbSoftFailEvent(val category: KbSoftFailEvent.Category, val problem: String, val input: String?, val transformName: String?, val location: KbSourceLocation?)

A structured description of a single soft failure that occurred while rendering a KbTemplate.

Link copied to clipboard
class KbSourceLocation(val line: Int, val column: Int, val sourceText: String, val templateStack: List<KbTemplateOrigin> = listOf(KbTemplateOrigin.Root))

The position of a failing expression within the template source.

Link copied to clipboard
sealed interface KbTemplate

Represents a compiled kBars template ready for rendering.

Link copied to clipboard
sealed interface KbTemplateOrigin

Identifies which template a KbSourceLocation was captured from.

Link copied to clipboard
fun interface KbTransform

A pluggable transformation applied to a KpaElement inside an expression chain (e.g. {{ foo | upcase }}).

Link copied to clipboard
sealed interface KbTransformable

A value that flows through the kBars transform chain. A KbTransformable wraps a KpaElement or — in the future — other scalar types like DateTime. This separates transform-chain results from the base data model.

Link copied to clipboard
sealed interface KbTransformScope

The receiver scope inside a KbTransform lambda. Exposes coercion helpers and the active KpaElementFactory so transforms can read inputs as Kotlin types and produce typed KpaElement results without hard-coding an adapter family.

Functions

Link copied to clipboard
Link copied to clipboard
fun KbTransformScope.asElement(value: KbTransformable?): KpaElement?

Extracts the wrapped KpaElement from value, or null when value is null.

Link copied to clipboard

Coerces element to an Int by routing through asString then toIntOrNull, returning null when the string is not a valid integer representation.

Link copied to clipboard
fun KbTransformScope.asList(value: KbTransformable?): KpaList?

Extracts the wrapped KpaList from value, or null when value is null or wraps a non-list element.

Link copied to clipboard

Coerces element to a Double when it wraps a numeric primitive or a numeric-string primitive; null otherwise.

Link copied to clipboard

Coerces value to its rendered string form using the same rule as {{ identifier }}.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun KbTransformScope.element(value: KpaElement?): KbTransformable?

Null-safely wraps value as a KbTransformable, returning null when value is null.

Link copied to clipboard
fun KbTransformScope.list(items: List<KpaElement>): KbTransformable

Wraps items as a list KbTransformable using the active KbTransformScope.factory.

Link copied to clipboard
Link copied to clipboard