Interface ResourceDiff.PropertyValidator

  • Enclosing class:
    ResourceDiff<T extends IExtendedResource>

    public static interface ResourceDiff.PropertyValidator
    A validator that checks whether a property should be taken into account while computing the diff between 2 resources.
    Since:
    1.14.0
    • Method Detail

      • isValidDefinition

        boolean isValidDefinition​(URI propertyDefinition)
        Checks whether a property with the given definition should be processed with the diff.
        Parameters:
        propertyDefinition - the property definition
        Returns:
        true if the property should be processed with the diff, false if it should be ignored
      • isValidValue

        boolean isValidValue​(URI propertyDefinition,
                             Object value)
        Checks whether a property with the given value should be processed with the diff.

        Note that value is never null and is never an array or a collection. If a property contains several values, this method is called once for each value.

        If isValidDefinition(URI) returns false, this method is not called.

        Parameters:
        propertyDefinition - the property definition
        value - the property value
        Returns:
        true if the property should be processed with the diff, false if it should be ignored
      • ignoreOriginalValues

        default boolean ignoreOriginalValues()
        Indicate to ignore this validator on original values during the diff. This allows to remove elements even if the properties are not validated. Validation will still be done when creating elements.

        Example: Only implementsRequirement is a valid property.

        An element with 2 links:

        • 1 implementsRequirement targeting A
        • 1 affectedByDefect targeting B
        If an updated element is sent with 2 other links:
        • 1 implementsRequirement targeting C
        • 1 affectedByDefect targeting D
        With ignoreValidatorForOriginalValues true, result will be:
        • 1 implementsRequirement targeting C
        With ignoreValidatorForOriginalValues false, result will be:
        • 1 implementsRequirement targeting C
        • 1 affectedByDefect targeting B
        Returns:
        a boolean to indicate if validator has to be checked on original value or not
        Since:
        3.1.0
        See Also:
        ResourceDiff.ResourceDiffBuilder.build()