Package overit.geocall.sql.code.fragment
Class FragmentSequence
java.lang.Object
overit.geocall.sql.code.fragment.Fragment
overit.geocall.sql.code.fragment.FragmentSequence
The class extends
For example "A>B AND C=1" or "AUSENAME,AUSESURNAME".
Fragment and aims to representing a sequence of separated fragments.For example "A>B AND C=1" or "AUSENAME,AUSESURNAME".
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Stringprotected final Stringprotected final StringFields inherited from class overit.geocall.sql.code.fragment.Fragment
_criterion -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new FragmentSequenceFragmentSequence(String separator) Creates a new FragmentSequenceFragmentSequence(String prefix, String separator, String suffix) Creates a new FragmentSequence -
Method Summary
Modifier and TypeMethodDescriptionfinal FragmentSequenceAdd a Fragment to the sequence.final FragmentSequenceAdd a Fragment to the sequence.booleanThis method is used to create the Fragment's SQL string.final FragmentSequenceclear()Clear all the fragment set on the sequence.get(int i) Gets the Fragment to the i-th of the sequence.intsize()Gets the number of fragments in the sequence.Methods inherited from class overit.geocall.sql.code.fragment.Fragment
getCriterion, overlapCriterion, replaceCriterion, toString
-
Field Details
-
_fragments
-
_separator
-
_prefix
-
_suffix
-
-
Constructor Details
-
FragmentSequence
public FragmentSequence()Creates a new FragmentSequence -
FragmentSequence
Creates a new FragmentSequence- Parameters:
separator- The separator
-
FragmentSequence
Creates a new FragmentSequence- Parameters:
prefix- The prefixseparator- The separatorsuffix- The suffix
-
-
Method Details
-
add
Add a Fragment to the sequence.- Parameters:
fragment- The Fragment to Add.- Returns:
- The Fragment sequence with fragment added.
-
add
Add a Fragment to the sequence.- Parameters:
fragment- The Fragment to Add.- Returns:
- The Fragment sequence with fragment added.
-
clear
Clear all the fragment set on the sequence.- Returns:
- An empty FragmentSequence.
-
get
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:FragmentThis method is used to create the Fragment's SQL string.- Specified by:
appendToin classFragment- 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:
trueif there's a Fragment to add,falseotherwise.
-