Class DefaultEntityValidator

    • Constructor Detail

      • DefaultEntityValidator

        public DefaultEntityValidator()
    • Method Detail

      • isValid

        public boolean isValid​(Entity entity)
        Description copied from interface: EntityValidator
        Returns true if the given entity contains only valid values.
        Specified by:
        isValid in interface EntityValidator
        Parameters:
        entity - the entity
        Returns:
        true if the given entity contains only valid values
      • isNullable

        public <T> boolean isNullable​(Entity entity,
                                      Attribute<T> attribute)
        Description copied from interface: EntityValidator
        Returns true if the property based on the given attribute accepts a null value for the given entity, by default this method simply returns the nullable state of the property.
        Specified by:
        isNullable in interface EntityValidator
        Type Parameters:
        T - the value type
        Parameters:
        entity - the entity being validated
        attribute - the attribute
        Returns:
        true if the attribute accepts a null value
      • validate

        public <T> void validate​(Entity entity,
                                 Attribute<T> attribute)
                          throws ValidationException
        Description copied from interface: EntityValidator
        Checks if the value associated with the give attribute is valid, throws a ValidationException if not
        Specified by:
        validate in interface EntityValidator
        Type Parameters:
        T - the value type
        Parameters:
        entity - the entity to validate
        attribute - the attribute the value is associated with
        Throws:
        ValidationException - if the given value is not valid for the given attribute