Package dev.morphia.query.validation
Class EntityTypeAndIdValueValidator
- java.lang.Object
-
- dev.morphia.query.validation.EntityTypeAndIdValueValidator
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
apply(MappedClass mappedClass, MappedField mappedField, java.lang.Object value, java.util.List<ValidationFailure> validationFailures)
Checks the class of thevalue
against the type of the ID for thetype
.static EntityTypeAndIdValueValidator
getInstance()
Get the instance.
-
-
-
Method Detail
-
getInstance
public static EntityTypeAndIdValueValidator getInstance()
Get the instance.- Returns:
- the Singleton instance of this validator
-
apply
public boolean apply(MappedClass mappedClass, MappedField mappedField, java.lang.Object value, java.util.List<ValidationFailure> validationFailures)
Checks the class of thevalue
against the type of the ID for thetype
. Always applies this validation, but there's room to change this to not apply it if, for example, the type is not an entity.- Parameters:
mappedClass
- the MappedClassmappedField
- the MappedFieldvalue
- the value for the queryvalidationFailures
- the list to add any failures to. If validation passes orappliesTo
returned false, this list will not change.- Returns:
- true if the validation was applied.
-
-