Class ConstraintTransformer<T>

java.lang.Object
com.flowingcode.backendcore.model.ConstraintTransformer<T>
Type Parameters:
T - The type of the implementation-specific representation of the constraint.
All Implemented Interfaces:
Function<Constraint,T>

public abstract class ConstraintTransformer<T> extends Object implements Function<Constraint,T>
Transform a Constraint into an implementation-specific representation (such as a JPA Expression). Subclasses are expected to override the transform(Constraint) method in order to support additional constraint types, and one or more of the transform*Constraint methods for providing the actual representations for the underlying database technology.
Author:
Javier Godoy / Flowing Code
  • Constructor Details

    • ConstraintTransformer

      public ConstraintTransformer()
  • Method Details

    • apply

      public final T apply(Constraint c)
      Return an implementation-specific representation of the constraint.
      Specified by:
      apply in interface Function<Constraint,T>
      Throws:
      ConstraintTransformerException - if the Constraint is not supported by this implementation.
    • transform

      protected T transform(Constraint c)
      Return an implementation-specific representation of the constraint, or null if it cannot be transformed. This method delegated into one of the of the transform*Constraint methods, depending on the actual constraint class.
    • transformRelationalConstraint

      protected T transformRelationalConstraint(AttributeRelationalConstraint c)
      Return an implementation-specific representation of an AttributeRelationalConstraint constraint.
      Returns:
      an implementation-specific representation of the constraint, or null if it cannot be transformed.
    • transformLikeConstraint

      protected T transformLikeConstraint(AttributeLikeConstraint c)
      Return an implementation-specific representation of an AttributeLikeConstraint constraint.
      Returns:
      an implementation-specific representation of the constraint, or null if it cannot be transformed.
    • transformBetweenConstraint

      protected T transformBetweenConstraint(AttributeBetweenConstraint c)
      Return an implementation-specific representation of an AttributeBetweenConstraint constraint.
      Returns:
      an implementation-specific representation of the constraint, or null if it cannot be transformed.
    • transformInConstraint

      protected T transformInConstraint(AttributeInConstraint c)
      Return an implementation-specific representation of an AttributeInConstraint constraint.
      Returns:
      an implementation-specific representation of the constraint, or null if it cannot be transformed.
    • transformNegatedConstraint

      protected T transformNegatedConstraint(NegatedConstraint c)
      Return an implementation-specific representation of a NegatedConstraint constraint.
      Returns:
      an implementation-specific representation of the constraint, or null if it cannot be transformed.
    • transformNullConstraint

      protected T transformNullConstraint(AttributeNullConstraint c)
      Return an implementation-specific representation of a AttributeNullConstraint constraint.
      Returns:
      an implementation-specific representation of the constraint, or null if it cannot be transformed.
    • transformILikeConstraint

      protected T transformILikeConstraint(AttributeILikeConstraint c)
      Return an implementation-specific representation of an AttributeILikeConstraint constraint.
      Returns:
      an implementation-specific representation of the constraint, or null if it cannot be transformed.