-
- All Implemented Interfaces:
-
com.weedow.spring.data.search.validation.DataSearchValidator
public abstract class AbstractFieldPathValidator implements DataSearchValidator
Base Class of DataSearchValidator to validate FieldExpressions according to their field path.
Example:
Let's assume the following model:
@Entity class Person( ... @Column(unique = true, length = 100) val email: String? = null, ... @OneToOne(mappedBy = "person", cascade = [CascadeType.ALL], orphanRemoval = true) @JsonIgnoreProperties("person") val jobEntity: Job? = null, ... ) @Entity class Job( ... @Column(unique = true, length = 100) val email: String? = null, ... )
Let's assume a Validator to validate Person email and Job email.
This validator should be instantiated with the different field paths, and added to a SearchDescriptor:
fun personSearchDescriptor(): SearchDescriptor<Person> = SearchDescriptorBuilder.builder<Person>() .validators(EmailValidator("email", "job.email")) .build()
-
-
Constructor Summary
Constructors Constructor Description AbstractFieldPathValidator(String fieldPaths)
-
Method Summary
Modifier and Type Method Description Boolean
supports(FieldExpression fieldExpression)
Checks if the given FieldExpression is supported by the validator. -
Methods inherited from class com.weedow.spring.data.search.validation.validator.AbstractFieldPathValidator
validate, validateCollection, validateSingle
-
Methods inherited from class com.weedow.spring.data.search.validation.DataSearchValidator
equals, hashCode, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
AbstractFieldPathValidator
AbstractFieldPathValidator(String fieldPaths)
- Parameters:
fieldPaths
- Field paths to validate
-
-
Method Detail
-
supports
Boolean supports(FieldExpression fieldExpression)
Checks if the given FieldExpression is supported by the validator.
- Parameters:
fieldExpression
- FieldExpression to check
-
-
-
-