case class ConstraintMapping(annotationType: Class[_ <: Annotation], constraintValidator: Class[_ <: ConstraintValidator[_ <: Annotation, _]], includeExistingValidators: Boolean = true) extends Product with Serializable
Simple configuration class for defining constraint mappings for ScalaValidator configuration.
Usage
val customConstraintMapping: ConstraintMapping = ConstraintMapping(classOf[Annotation], classOf[ConstraintValidator]) val validator: ScalaValidator = ScalaValidator.builder .withConstraintMapping(customConstraintMapping) .validator
or multiple mappings
val customConstraintMapping1: ConstraintMapping = ??? val customConstraintMapping2: ConstraintMapping = ??? val validator: ScalaValidator = ScalaValidator.builder .withConstraintMappings(Set(customConstraintMapping1, customConstraintMapping2)) .validator
- annotationType
the
Class[Annotation]
of the constraint annotation.- constraintValidator
the implementing ConstraintValidator class for the given constraint annotation.
- includeExistingValidators
if this is an additional validator for the given constraint annotation type or if this should replace all existing validators for the given constraint annotation type. Default is true (additional).
- Note
adding multiple constraint mappings for the same annotation type will result in a ValidationException being thrown.
- Alphabetic
- By Inheritance
- ConstraintMapping
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new ConstraintMapping(annotationType: Class[_ <: Annotation], constraintValidator: Class[_ <: ConstraintValidator[_ <: Annotation, _]], includeExistingValidators: Boolean = true)
- annotationType
the
Class[Annotation]
of the constraint annotation.- constraintValidator
the implementing ConstraintValidator class for the given constraint annotation.
- includeExistingValidators
if this is an additional validator for the given constraint annotation type or if this should replace all existing validators for the given constraint annotation type. Default is true (additional).
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val annotationType: Class[_ <: Annotation]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- val constraintValidator: Class[_ <: ConstraintValidator[_ <: Annotation, _]]
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- val includeExistingValidators: Boolean
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()