All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kreuzberg.extras.forms.annotations.scala Maven / Gradle / Ivy

There is a newer version: 0.10.3
Show newest version
package kreuzberg.extras.forms

import scala.annotation.StaticAnnotation

/** Annotation to control field generation. */
case class UseField[-T](
    name: String = "",
    label: String = "",
    placeholder: String = "",
    ftype: String = "",
    validator: Validator[T] = Validator.succeed,
    required: Boolean = false
) extends StaticAnnotation {

  /** Returns the name to use for this field. */
  def nameToUse(fieldName: String): String = {
    if (name.isEmpty) {
      fieldName
    } else {
      name
    }
  }
}

/** Annotation to control main validator. */
case class UseValidator[-T](validator: Validator[T]) extends StaticAnnotation




© 2015 - 2025 Weber Informatics LLC | Privacy Policy