Class FragmentSequence

java.lang.Object
overit.geocall.sql.code.fragment.Fragment
overit.geocall.sql.code.fragment.FragmentSequence
Direct Known Subclasses:
Condition, Sql

public class FragmentSequence extends Fragment
The class extends Fragment and aims to representing a sequence of separated fragments.
For example "A>B AND C=1" or "AUSENAME,AUSESURNAME".
  • Field Details

    • _fragments

      protected final ArrayList<Fragment> _fragments
    • _separator

      protected final String _separator
    • _prefix

      protected final String _prefix
    • _suffix

      protected final String _suffix
  • Constructor Details

    • FragmentSequence

      public FragmentSequence()
      Creates a new FragmentSequence
    • FragmentSequence

      public FragmentSequence(String separator)
      Creates a new FragmentSequence
      Parameters:
      separator - The separator
    • FragmentSequence

      public FragmentSequence(String prefix, String separator, String suffix)
      Creates a new FragmentSequence
      Parameters:
      prefix - The prefix
      separator - The separator
      suffix - The suffix
  • Method Details

    • add

      public final FragmentSequence add(Fragment fragment)
      Add a Fragment to the sequence.
      Parameters:
      fragment - The Fragment to Add.
      Returns:
      The Fragment sequence with fragment added.
    • add

      public final FragmentSequence add(String fragment)
      Add a Fragment to the sequence.
      Parameters:
      fragment - The Fragment to Add.
      Returns:
      The Fragment sequence with fragment added.
    • clear

      public final FragmentSequence clear()
      Clear all the fragment set on the sequence.
      Returns:
      An empty FragmentSequence.
    • get

      public Fragment get(int i)
      Gets the Fragment to the i-th of the sequence.
      Parameters:
      i - The i-th position of the fragment.
      Returns:
      The Fragment to the i-th of the sequence.
    • size

      public int size()
      Gets the number of fragments in the sequence.
      Returns:
      The number of fragments in the sequence.
    • appendTo

      public boolean appendTo(StringBuilder sb, String header, Criterion defaultCriterion, Map<String,Object> context)
      Description copied from class: Fragment
      This method is used to create the Fragment's SQL string.
      Specified by:
      appendTo in class Fragment
      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.