class ScalaValidator extends ScalaExecutableValidator with Logging
- Alphabetic
- By Inheritance
- ScalaValidator
- Logging
- ScalaExecutableValidator
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
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
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def close(): Unit
Close resources.
- 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
- 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
- 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
- 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
- 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
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- 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
- 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
- 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
- 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
- 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
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- 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 theISO3166CountryCodeConstraintValidator
.- 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.
- def forExecutables: ScalaExecutableValidator
Returns the contract for validating parameters and return values of methods and constructors.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- 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
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- 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
- 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
- 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
- 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
- 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
- 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.
- 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.
- 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. Returnstrue
if enabled,false
otherwise.- Attributes
- protected[this]
- Definition Classes
- Logging
- 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
- 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. Returnstrue
if enabled,false
otherwise.- Attributes
- protected[this]
- Definition Classes
- Logging
- 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
- 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. Returnstrue
if enabled,false
otherwise.- Attributes
- protected[this]
- Definition Classes
- Logging
- 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
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- 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. Returnstrue
if enabled,false
otherwise.- Attributes
- protected[this]
- Definition Classes
- Logging
- 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
- 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. Returnstrue
if enabled,false
otherwise.- Attributes
- protected[this]
- Definition Classes
- Logging
- 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
- final def logger: Logger
Return the underlying com.twitter.util.logging.Logger
Return the underlying com.twitter.util.logging.Logger
- returns
- Attributes
- protected[this]
- Definition Classes
- Logging
- 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
- 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()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- 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
- 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
- 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
- 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
- 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
- val underlying: Validator
- 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.
- 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.
- 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
- ScalaValidator → ScalaExecutableValidator
- 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
- ScalaValidator → ScalaExecutableValidator
- 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
- ScalaValidator → ScalaExecutableValidator
- 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
- ScalaValidator → ScalaExecutableValidator
- 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
- ScalaValidator → ScalaExecutableValidator
- 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
- ScalaValidator → ScalaExecutableValidator
- 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.
- 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
- ScalaValidator → ScalaExecutableValidator
- 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 thefieldName
field value werevalue
.Validates all constraint constraints on the
fieldName
field of the class described by the given CaseClassDescriptor if thefieldName
field value werevalue
.- 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.
- 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 classbeanType
if thefieldName
field value werevalue
.Validates all constraint constraints on the
fieldName
field of the given classbeanType
if thefieldName
field value werevalue
.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.
- 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.
- 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()
- 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
- 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
- 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
- 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
- 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