11package eu .qwsome .sql ;
22
33import eu .qwsome .sql .api .Appendable ;
4- import eu .qwsome .sql .condition .Condition ;
54import eu .qwsome .sql .condition .ValueConstructor ;
65
76/**
8- * Crate for join attributes.
9- *
107 * @author Lukáš Kvídera
118 */
12- abstract class Join implements Appendable {
13-
14- /**
15- * Table used in JOIN clause.
16- */
17- private final String joinTable ;
18-
19- /**
20- * Condition in ON clause.
21- */
22- private final Condition condition ;
23-
24- Join (final String joinTable , final Condition condition ) {
25- this .joinTable = joinTable ;
26- this .condition = condition ;
27- }
28-
29- public CharSequence get () {
30- final StringBuilder builder = new StringBuilder ();
31- appendTo (builder );
32- return builder ;
33- }
34-
35- /**
36- * @return tyoe if join
37- */
38- abstract CharSequence getPrefix ();
39-
40- @ Override
41- public void appendTo (final StringBuilder builder ) {
42- builder .append (getPrefix ())
43- .append (" JOIN " )
44- .append (this .joinTable )
45- .append (" ON " );
46-
47- this .condition .appendTo (builder );
48- }
49-
50- /**
51- * @return variables to be bound in ON clause's conditions
52- */
53- ValueConstructor toValues () {
54- return this .condition .getValues ();
55- }
56-
57- /**
58- * This enum determines type of join.
59- */
60- enum Type {
61- LEFT ,
62- INNER
63- }
64- }
9+ interface Join extends Appendable {
10+ ValueConstructor toValues ();
11+ }
0 commit comments