01: /**
02: * Objective Database Abstraction Layer (ODAL)
03: * Copyright (c) 2004, The ODAL Development Group
04: * All rights reserved.
05: * For definition of the ODAL Development Group please refer to LICENCE.txt file
06: *
07: * Distributable under LGPL license.
08: * See terms of license at gnu.org.
09: */package com.completex.objective.components.persistency.core;
10:
11: import java.util.HashMap;
12: import java.io.Serializable;
13:
14: /**
15: * Represents union type: "UNION" or "UNION ALL"
16: *
17: * @author Gennady Krizhevsky
18: */
19: public class UnionMode implements Serializable {
20:
21: protected static final String TYPE_UNION = "UNION";
22: protected static final String TYPE_UNION_ALL = "UNION ALL";
23:
24: public static final UnionMode UNION = new UnionMode(TYPE_UNION);
25: public static final UnionMode UNION_ALL = new UnionMode(
26: TYPE_UNION_ALL);
27:
28: private static final HashMap MODES = new HashMap();
29:
30: static {
31: MODES.put(UNION.getName(), UNION);
32: MODES.put(UNION_ALL.getName(), UNION_ALL);
33: }
34:
35: private String name;
36: private String sqlString;
37:
38: public UnionMode(String name) {
39: this .name = name;
40: this .sqlString = " " + name + " ";
41: }
42:
43: public String getName() {
44: return name;
45: }
46:
47: public String getSqlString() {
48: return sqlString;
49: }
50:
51: public static UnionMode name2mode(String name) {
52: return (UnionMode) MODES.get(name);
53: }
54:
55: public String toString() {
56: return getName();
57: }
58: }
|