/** * Validate a {@link CanonicalValue} representation. Implementations should override this method if they can * provide a validation algorithm which does not rely on canonical strings but works on representation state only. * * @param value Representation value * @return Validated representation or a {@link CanonicalValueViolation} * @throws NullPointerException if {@code value} is null */ default Variant<T, CanonicalValueViolation> validateRepresentation(final T value) { return validateRepresentation(value, value.toCanonicalString()); }
/** * Validate a {@link CanonicalValue} representation. Implementations should override this method if they can * provide a validation algorithm which does not rely on canonical strings but works on representation state only. * * @param value Representation value * @return Validated representation or a {@link CanonicalValueViolation} * @throws NullPointerException if {@code value} is null */ default Variant<T, CanonicalValueViolation> validateRepresentation(final T value) { return validateRepresentation(value, value.toCanonicalString()); }