StartsWithRule

Properties

Link copied to clipboard
open override val annotationFqName: String
Link copied to clipboard
open override val defaultMessage: String
Link copied to clipboard
open override val errorCode: String

Functions

Link copied to clipboard
open fun generateAuxiliaryProperties(target: KSDeclaration, annotation: KSAnnotation, propName: String): List<PropertySpec>

Generates any companion/validator object auxiliary fields (e.g. Regex patterns, allowed values sets).

Link copied to clipboard
open override fun generateCondition(target: KSDeclaration, annotation: KSAnnotation, valName: String): CodeBlock

Generates the boolean condition that triggers a validation failure (evaluates to true on failure).

Link copied to clipboard
open override fun getDefaultMessage(annotation: KSAnnotation): String
Link copied to clipboard
open fun getErrorField(target: KSDeclaration, annotation: KSAnnotation, defaultField: String): String

Customizes the field name reported in the ValidationError.

Link copied to clipboard
open fun getRejectedValueExpression(target: KSDeclaration, annotation: KSAnnotation, defaultExpression: String): String

Customizes the expression used to capture the rejected value in the ValidationError.

Link copied to clipboard
open fun toConstraintMetadata(annotation: KSAnnotation, message: String, messageKey: String, groups: List<String>): ConstraintMetadata

Maps the annotation to a ConstraintMetadata object at compile time.

Link copied to clipboard
open override fun validate(target: KSDeclaration, annotation: KSAnnotation, logger: KSPLogger): Boolean

Performs compile-time check of target type and annotation arguments. Logs error via logger.error if validation fails, returning false.