Class Fragment

java.lang.Object
overit.geocall.sql.code.fragment.Fragment
Direct Known Subclasses:
ClauseFragment, ClausesFragment, EnclosedDoubleFragment, EnclosedFragment, FragmentSequence, StillFragment

public abstract class Fragment extends Object
The class represent a piece that will compose a SQL string.
  • Field Details

    • _criterion

      protected Criterion _criterion
  • Constructor Details

    • Fragment

      public Fragment()
  • Method Details

    • overlapCriterion

      public void overlapCriterion(Criterion criterion)
      Adds an overlapping criterion.
      Parameters:
      criterion - The priority criterion to be addes to the current criterion.
    • replaceCriterion

      public void replaceCriterion(Criterion criterion)
      Replace the oldest Criterion with a new one.
      Parameters:
      criterion - The new Criterion to set.
    • getCriterion

      public Criterion getCriterion(Criterion def)
      Gets the current set Criterion.
      Parameters:
      def - The default object to return if there's no Criterion set.
      Returns:
      The current Criterion if it's set, def otherwise.
    • appendTo

      public abstract boolean appendTo(StringBuilder sb, String header, Criterion defaultCriterion, Map<String,Object> context)
      This method is used to create the Fragment's SQL string.
      Parameters:
      sb - The StringBuilder used to add the current piece (Fragment) of SQL cod, to create the complete SQL string.
      header - The string previus the Fragment's code.
      defaultCriterion - The Criterion, set by default, to apply.
      context - The input values to define the clauses of the sql string.
      Returns:
      true if there's a Fragment to add, false otherwise.
    • toString

      public String toString(Criterion defaultCriterion, Map<String,Object> context)
      Gets the translation, in sql string, of the fragment
      Parameters:
      defaultCriterion - The defautl criterion used as decision criterion.
      context - The input values to define the clauses of the sql string.
      Returns:
      The translation, in sql string, of the fragment