Validator

abstract class Validator<T : Any>(val targetType: KClass<T>)

Base class for field value validators used with the field-anchored @Validate annotation.

Implementations MUST be object singletons — the processor emits direct FQN calls (e.g. NotBlankValidator.validate(x)) with no reflection.

The validate method receives a NON-NULL value. Null handling is owned by the ladder seams in generated code; validators only fire when a non-null value is present.

Parameters

targetType

the KClass of T, used for documentation/introspection

Type Parameters

T

the type of value this validator accepts

Inheritors

Constructors

Link copied to clipboard
constructor(targetType: KClass<T>)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
abstract fun validate(value: T): String?

Returns null if value is valid, or a human-readable reason string if invalid.