Packages

class ScalaValidator extends ScalaExecutableValidator with Logging

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ScalaValidator
  2. Logging
  3. ScalaExecutableValidator
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. def close(): Unit

    Close resources.

  7. def debug(marker: Marker, message: => Any, cause: Throwable): Unit

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Attributes
    protected[this]
    Definition Classes
    Logging
  8. def debug(message: => Any, cause: Throwable): Unit

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Attributes
    protected[this]
    Definition Classes
    Logging
  9. def debug(marker: Marker, message: => Any): Unit

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Attributes
    protected[this]
    Definition Classes
    Logging
  10. def debug(message: => Any): Unit

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Attributes
    protected[this]
    Definition Classes
    Logging
  11. def debugResult[T](message: => String)(fn: => T): T

    Log the given message at the named log level formatted with the result of the passed in function using the underlying logger.

    Log the given message at the named log level formatted with the result of the passed in function using the underlying logger. The incoming string message should contain a single %s which will be replaced with the result[T] of the given function.

    Example:

    infoResult("The answer is: %s") {"42"}
    Attributes
    protected[this]
    Definition Classes
    Logging
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  14. def error(marker: Marker, message: => Any, cause: Throwable): Unit

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Attributes
    protected[this]
    Definition Classes
    Logging
  15. def error(message: => Any, cause: Throwable): Unit

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Attributes
    protected[this]
    Definition Classes
    Logging
  16. def error(marker: Marker, message: => Any): Unit

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Attributes
    protected[this]
    Definition Classes
    Logging
  17. def error(message: => Any): Unit

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Attributes
    protected[this]
    Definition Classes
    Logging
  18. def errorResult[T](message: => String)(fn: => T): T

    Log the given message at the named log level formatted with the result of the passed in function using the underlying logger.

    Log the given message at the named log level formatted with the result of the passed in function using the underlying logger. The incoming string message should contain a single %s which will be replaced with the result[T] of the given function.

    Example:

    infoResult("The answer is: %s") {"42"}
    Attributes
    protected[this]
    Definition Classes
    Logging
  19. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  20. val findConstraintValidators: (Class[_ <: Annotation]) => Set[ConstraintValidatorType]

    Returns the set of Constraints which validate the given Annotation class.

    Returns the set of Constraints which validate the given Annotation class.

    For instance if the constraint type is Class[com.twitter.util.validation.constraints.CountryCode], the returned set would contain an instance of the ISO3166CountryCodeConstraintValidator.

    returns

    the set of supporting constraint validators for a given Annotation.

    Note

    this method is memoized as it should only ever need to be calculated once for a given Class.

  21. def forExecutables: ScalaExecutableValidator

    Returns the contract for validating parameters and return values of methods and constructors.

  22. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  23. def getConstraintsForClass[T](clazz: Class[T]): CaseClassDescriptor[T]

    Returns a CaseClassDescriptor object describing the given case class type constraints.

    Returns a CaseClassDescriptor object describing the given case class type constraints. Descriptors describe constraints on a given class and any cascaded case class types.

    The returned object (and associated objects including CaseClassDescriptors) are immutable.

    T

    the clazz type

    clazz

    class or interface type evaluated

    returns

    the CaseClassDescriptor for the specified class

    See also

    CaseClassDescriptor

  24. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  25. def info(marker: Marker, message: => Any, cause: Throwable): Unit

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Attributes
    protected[this]
    Definition Classes
    Logging
  26. def info(message: => Any, cause: Throwable): Unit

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Attributes
    protected[this]
    Definition Classes
    Logging
  27. def info(marker: Marker, message: => Any): Unit

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Attributes
    protected[this]
    Definition Classes
    Logging
  28. def info(message: => Any): Unit

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Attributes
    protected[this]
    Definition Classes
    Logging
  29. def infoResult[T](message: => String)(fn: => T): T

    Log the given message at the named log level formatted with the result of the passed in function using the underlying logger.

    Log the given message at the named log level formatted with the result of the passed in function using the underlying logger. The incoming string message should contain a single %s which will be replaced with the result[T] of the given function.

    Example:

    infoResult("The answer is: %s") {"42"}
    Attributes
    protected[this]
    Definition Classes
    Logging
  30. def isConstraintAnnotation(annotation: Annotation): Boolean

    Checks whether the specified Annotation is a valid constraint constraint.

    Checks whether the specified Annotation is a valid constraint constraint. A constraint constraint has to fulfill the following conditions:

    • Must be annotated with jakarta.validation.Constraint
    • Define a message parameter
    • Define a groups parameter
    • Define a payload parameter
    annotation

    The Annotation to test.

    returns

    true if the constraint fulfills the above conditions, false otherwise.

  31. val isConstraintAnnotation: (Class[_ <: Annotation]) => Boolean

    Checks whether the specified Annotation clazz is a valid constraint constraint.

    Checks whether the specified Annotation clazz is a valid constraint constraint. A constraint constraint has to fulfill the following conditions:

    • Must be annotated with jakarta.validation.Constraint
    • Define a message parameter
    • Define a groups parameter
    • Define a payload parameter
    returns

    true if the constraint fulfills the above conditions, false otherwise.

    Note

    this method is memoized as it should only ever need to be calculated once for a given Class.

  32. def isDebugEnabled(marker: Marker): Boolean

    Determines if the named log level is enabled on the underlying logger taking into consideration the given org.slf4j.Marker data.

    Determines if the named log level is enabled on the underlying logger taking into consideration the given org.slf4j.Marker data. Returns true if enabled, false otherwise.

    Attributes
    protected[this]
    Definition Classes
    Logging
  33. def isDebugEnabled: Boolean

    Determines if the named log level is enabled on the underlying logger.

    Determines if the named log level is enabled on the underlying logger. Returns true if enabled, false otherwise.

    Attributes
    protected[this]
    Definition Classes
    Logging
  34. def isErrorEnabled(marker: Marker): Boolean

    Determines if the named log level is enabled on the underlying logger taking into consideration the given org.slf4j.Marker data.

    Determines if the named log level is enabled on the underlying logger taking into consideration the given org.slf4j.Marker data. Returns true if enabled, false otherwise.

    Attributes
    protected[this]
    Definition Classes
    Logging
  35. def isErrorEnabled: Boolean

    Determines if the named log level is enabled on the underlying logger.

    Determines if the named log level is enabled on the underlying logger. Returns true if enabled, false otherwise.

    Attributes
    protected[this]
    Definition Classes
    Logging
  36. def isInfoEnabled(marker: Marker): Boolean

    Determines if the named log level is enabled on the underlying logger taking into consideration the given org.slf4j.Marker data.

    Determines if the named log level is enabled on the underlying logger taking into consideration the given org.slf4j.Marker data. Returns true if enabled, false otherwise.

    Attributes
    protected[this]
    Definition Classes
    Logging
  37. def isInfoEnabled: Boolean

    Determines if the named log level is enabled on the underlying logger.

    Determines if the named log level is enabled on the underlying logger. Returns true if enabled, false otherwise.

    Attributes
    protected[this]
    Definition Classes
    Logging
  38. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  39. def isTraceEnabled(marker: Marker): Boolean

    Determines if the named log level is enabled on the underlying logger taking into consideration the given org.slf4j.Marker data.

    Determines if the named log level is enabled on the underlying logger taking into consideration the given org.slf4j.Marker data. Returns true if enabled, false otherwise.

    Attributes
    protected[this]
    Definition Classes
    Logging
  40. def isTraceEnabled: Boolean

    Determines if the named log level is enabled on the underlying logger.

    Determines if the named log level is enabled on the underlying logger. Returns true if enabled, false otherwise.

    Attributes
    protected[this]
    Definition Classes
    Logging
  41. def isWarnEnabled(marker: Marker): Boolean

    Determines if the named log level is enabled on the underlying logger taking into consideration the given org.slf4j.Marker data.

    Determines if the named log level is enabled on the underlying logger taking into consideration the given org.slf4j.Marker data. Returns true if enabled, false otherwise.

    Attributes
    protected[this]
    Definition Classes
    Logging
  42. def isWarnEnabled: Boolean

    Determines if the named log level is enabled on the underlying logger.

    Determines if the named log level is enabled on the underlying logger. Returns true if enabled, false otherwise.

    Attributes
    protected[this]
    Definition Classes
    Logging
  43. final def logger: Logger

    Return the underlying com.twitter.util.logging.Logger

    Return the underlying com.twitter.util.logging.Logger

    returns

    a com.twitter.util.logging.Logger

    Attributes
    protected[this]
    Definition Classes
    Logging
  44. final def loggerName: String

    Return the name of the underlying com.twitter.util.logging.Logger

    Return the name of the underlying com.twitter.util.logging.Logger

    returns

    a String name

    Attributes
    protected[this]
    Definition Classes
    Logging
  45. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  46. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  47. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  48. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  49. def toString(): String
    Definition Classes
    AnyRef → Any
  50. def trace(marker: Marker, message: => Any, cause: Throwable): Unit

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Attributes
    protected[this]
    Definition Classes
    Logging
  51. def trace(message: => Any, cause: Throwable): Unit

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Attributes
    protected[this]
    Definition Classes
    Logging
  52. def trace(marker: Marker, message: => Any): Unit

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Attributes
    protected[this]
    Definition Classes
    Logging
  53. def trace(message: => Any): Unit

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Attributes
    protected[this]
    Definition Classes
    Logging
  54. def traceResult[T](message: => String)(fn: => T): T

    Log the given message at the named log level formatted with the result of the passed in function using the underlying logger.

    Log the given message at the named log level formatted with the result of the passed in function using the underlying logger. The incoming string message should contain a single %s which will be replaced with the result[T] of the given function.

    Example:

    infoResult("The answer is: %s") {"42"}
    Attributes
    protected[this]
    Definition Classes
    Logging
  55. val underlying: Validator
  56. def unwrap[U](clazz: Class[U]): U

    Returns an instance of the specified type allowing access to provider-specific APIs.

    Returns an instance of the specified type allowing access to provider-specific APIs.

    If the Jakarta Bean Validation provider implementation does not support the specified class, ValidationException is thrown.

    U

    the type of the object to be returned

    clazz

    the class of the object to be returned

    returns

    an instance of the specified class

    Annotations
    @throws(scala.this.throws.<init>$default$1[jakarta.validation.ValidationException])
    Exceptions thrown

    ValidationException - if the provider does not support the call.

  57. def validate[T](obj: T, groups: Class[_]*): Set[ConstraintViolation[T]]

    Validates all constraint constraints on an object.

    Validates all constraint constraints on an object.

    T

    the type of the object to validate.

    obj

    the object to validate.

    groups

    the list of groups targeted for validation (defaults to Default).

    returns

    constraint violations or an empty set if none

    Exceptions thrown

    IllegalArgumentException - if object is null.

  58. def validateConstructorParameters[T](constructor: Constructor[T], parameterValues: Array[Any], groups: Class[_]*): Set[ConstraintViolation[T]]

    Validates all constraints placed on the parameters of the given constructor.

    Validates all constraints placed on the parameters of the given constructor.

    T

    the type hosting the constructor to validate.

    constructor

    the constructor for which the parameter constraints is validated.

    parameterValues

    the values provided by the caller for the given constructor's parameters.

    groups

    the list of groups targeted for validation (defaults to Default).

    returns

    a set with the constraint violations caused by this validation; Will be empty if no error occurs, but never null.

    Definition Classes
    ScalaValidatorScalaExecutableValidator
  59. def validateConstructorReturnValue[T](constructor: Constructor[T], createdObject: T, groups: Class[_]*): Set[ConstraintViolation[T]]

    Validates all return value constraints of the given constructor.

    Validates all return value constraints of the given constructor.

    T

    the type hosting the constructor to validate.

    constructor

    the constructor for which the return value constraints is validated.

    createdObject

    the object instantiated by the given method.

    groups

    the list of groups targeted for validation (defaults to Default).

    returns

    a set with the constraint violations caused by this validation; will be empty, if no error occurs, but never null.

    Definition Classes
    ScalaValidatorScalaExecutableValidator
  60. def validateMethod[T](obj: T, method: Method, groups: Class[_]*): Set[ConstraintViolation[T]]

    Validates the given method annotated with @MethodValidation of the given object.

    Validates the given method annotated with @MethodValidation of the given object.

    T

    the type hosting the method to validate.

    obj

    the object on which the method to validate is invoked.

    method

    the @MethodValidation annotated method to invoke for validation.

    groups

    the list of groups targeted for validation (defaults to Default).

    returns

    a set with the constraint violations caused by this validation; will be empty if no error occurs, but never null.

    Definition Classes
    ScalaValidatorScalaExecutableValidator
  61. def validateMethodParameters[T](method: Method, parameterValues: Array[Any], groups: Class[_]*): Set[ConstraintViolation[T]]

    Validates all constraints placed on the parameters of the given method.

    Validates all constraints placed on the parameters of the given method.

    T

    the type defining the method to validate.

    method

    the method for which the parameter constraints is validated.

    parameterValues

    the values provided by the caller for the given method's parameters.

    groups

    the list of groups targeted for validation (defaults to Default).

    returns

    a set with the constraint violations caused by this validation; Will be empty if no error occurs, but never null.

    Definition Classes
    ScalaValidatorScalaExecutableValidator
  62. def validateMethods[T](obj: T, groups: Class[_]*): Set[ConstraintViolation[T]]

    Validates all methods annotated with @MethodValidation of the given object.

    Validates all methods annotated with @MethodValidation of the given object.

    T

    the type hosting the methods to validate.

    obj

    the object on which the methods to validate are invoked.

    groups

    the list of groups targeted for validation (defaults to Default).

    returns

    a set with the constraint violations caused by this validation; will be empty if no error occurs, but never null.

    Definition Classes
    ScalaValidatorScalaExecutableValidator
  63. def validateParameters[T](obj: T, method: Method, parameterValues: Array[Any], groups: Class[_]*): Set[ConstraintViolation[T]]

    Validates all constraints placed on the parameters of the given method.

    Validates all constraints placed on the parameters of the given method.

    T

    the type hosting the method to validate.

    obj

    the object on which the method to validate is invoked.

    method

    the method for which the parameter constraints is validated.

    parameterValues

    the values provided by the caller for the given method's parameters.

    groups

    the list of groups targeted for validation (defaults to Default).

    returns

    a set with the constraint violations caused by this validation; will be empty if no error occurs, but never null.

    Definition Classes
    ScalaValidatorScalaExecutableValidator
  64. def validateProperty[T](obj: T, propertyName: String, groups: Class[_]*): Set[ConstraintViolation[T]]

    Validates all constraint constraints on the fieldName field of the given object.

    Validates all constraint constraints on the fieldName field of the given object.

    Usage

    Validate the "id" field in case class MyClass (enabling the validation group "Checks"):

    case class MyClass(@NotEmpty(groups = classOf[Checks]) id)
    val i = MyClass("")
    validator.validateProperty(i, "id", Seq(classOf[Checks]))
    T

    the type of the object to validate.

    obj

    object to validate.

    propertyName

    property to validate (used in error reporting).

    groups

    the list of groups targeted for validation (defaults to Default).

    returns

    constraint violations or an empty set if none.

    Exceptions thrown

    IllegalArgumentException - if object is null, if fieldName is null, empty or not a valid object property.

  65. def validateReturnValue[T](obj: T, method: Method, returnValue: Any, groups: Class[_]*): Set[ConstraintViolation[T]]

    Validates all return value constraints of the given method.

    Validates all return value constraints of the given method.

    T

    the type hosting the method to validate.

    obj

    the object on which the method to validate is invoked.

    method

    the method for which the return value constraints is validated.

    returnValue

    the value returned by the given method.

    groups

    the list of groups targeted for validation (defaults to Default).

    returns

    a set with the constraint violations caused by this validation; will be empty if no error occurs, but never null.

    Definition Classes
    ScalaValidatorScalaExecutableValidator
  66. def validateValue[T](descriptor: CaseClassDescriptor[T], propertyName: String, value: Any, groups: Class[_]*): Set[ConstraintViolation[T]]

    Validates all constraint constraints on the fieldName field of the class described by the given CaseClassDescriptor if the fieldName field value were value.

    Validates all constraint constraints on the fieldName field of the class described by the given CaseClassDescriptor if the fieldName field value were value.

    T

    the type of the object to validate

    descriptor

    the CaseClassDescriptor of the described class.

    propertyName

    field to validate.

    value

    field value to validate.

    groups

    the list of groups targeted for validation (defaults to Default).

    returns

    constraint violations or an empty set if none

    Exceptions thrown

    IllegalArgumentException - if fieldName is null, empty or not a valid object property.

  67. def validateValue[T](beanType: Class[T], propertyName: String, value: Any, groups: Class[_]*): Set[ConstraintViolation[T]]

    Validates all constraint constraints on the fieldName field of the given class beanType if the fieldName field value were value.

    Validates all constraint constraints on the fieldName field of the given class beanType if the fieldName field value were value.

    ConstraintViolation objects return null for ConstraintViolation.getRootBean() and ConstraintViolation.getLeafBean().

    Usage

    Validate value of "" for the "id" field in case class MyClass (enabling group "Checks"):

    case class MyCaseClass(@NotEmpty(groups = classOf[Checks]) id)
    validator.validateFieldValue(classOf[MyCaseClass], "id", "", Seq(classOf[Checks]))
    T

    the type of the object to validate

    beanType

    the case class type.

    propertyName

    field to validate.

    value

    field value to validate.

    groups

    the list of groups targeted for validation (defaults to Default).

    returns

    constraint violations or an empty set if none

    Exceptions thrown

    IllegalArgumentException - if beanType is null, if fieldName is null, empty or not a valid object property.

  68. def verify(obj: Any, groups: Class[_]*): Unit

    Validates all constraint constraints on an object.

    Validates all constraint constraints on an object.

    obj

    the object to validate.

    Annotations
    @throws(scala.this.throws.<init>$default$1[jakarta.validation.ValidationException])
    Exceptions thrown

    IllegalArgumentException - if object is null.

    ValidationException - if any constraints produce a violation.

  69. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  70. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  71. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  72. def warn(marker: Marker, message: => Any, cause: Throwable): Unit

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Attributes
    protected[this]
    Definition Classes
    Logging
  73. def warn(message: => Any, cause: Throwable): Unit

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Attributes
    protected[this]
    Definition Classes
    Logging
  74. def warn(marker: Marker, message: => Any): Unit

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Logs the given message at the named log level with the underlying logger taking into consideration the given org.slf4j.Marker data.

    Attributes
    protected[this]
    Definition Classes
    Logging
  75. def warn(message: => Any): Unit

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Logs the given message at the named log level using call-by-name for the message parameter with the underlying logger.

    Attributes
    protected[this]
    Definition Classes
    Logging
  76. def warnResult[T](message: => String)(fn: => T): T

    Log the given message at the named log level formatted with the result of the passed in function using the underlying logger.

    Log the given message at the named log level formatted with the result of the passed in function using the underlying logger. The incoming string message should contain a single %s which will be replaced with the result[T] of the given function.

    Example:

    infoResult("The answer is: %s") {"42"}
    Attributes
    protected[this]
    Definition Classes
    Logging

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped