Class IntegrityConstraintsValidator

java.lang.Object
cz.cvut.kbss.jopa.sessions.validator.IntegrityConstraintsValidator

public abstract class IntegrityConstraintsValidator extends Object
  • Constructor Details

    • IntegrityConstraintsValidator

      public IntegrityConstraintsValidator()
  • Method Details

    • getValidator

      public static IntegrityConstraintsValidator getValidator()
    • validate

      @SafeVarargs public final <T> void validate(T instance, EntityType<T> et, Predicate<FieldSpecification<? super T,?>>... filters)
      Validates integrity constraints of all attributes of the specified instance.
      Type Parameters:
      T - Entity class type
      Parameters:
      instance - The instance to validate
      et - EntityType of the instance
      filters - Filters allowing to specify attributes whose validation should be skipped
    • validate

      public void validate(ObjectChangeSet changeSet, Metamodel metamodel)
      Validates integrity constraints for changes in the specified change set.
      Parameters:
      changeSet - The change set to validate
      metamodel - Metamodel of the persistence unit
    • validate

      public abstract void validate(Object identifier, FieldSpecification<?,?> attribute, Object attributeValue)
      Validates whether the specified value conforms to the attribute integrity constraints.
      Parameters:
      identifier - Instance identifier
      attribute - Attribute metadata with integrity constraints
      attributeValue - Value to be validated
    • isNotLazy

      public static <T> Predicate<FieldSpecification<? super T,?>> isNotLazy()
      Creates a predicate filtering attributes whose fetch type is FetchType.LAZY.
      Type Parameters:
      T - Entity type
      Returns:
      Predicate
    • isNotInferred

      public static <T> Predicate<FieldSpecification<? super T,?>> isNotInferred()
      Creates a predicate filtering attributes that contain inferred values.
      Type Parameters:
      T - Entity type
      Returns:
      Predicate