formatter: FormatterContext v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Fri, 20 Dec 2013 22:58:02 +0100
branchv_0
changeset 24 65e3fffae091
parent 23 d8faf91519a5
child 25 4c118af3e855
formatter: FormatterContext
java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractFormatter.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/FormatterContext.java
--- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractFormatter.java	Fri Dec 20 22:19:10 2013 +0100
+++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractFormatter.java	Fri Dec 20 22:58:02 2013 +0100
@@ -18,7 +18,6 @@
 package info.globalcode.sql.dk.formatting;
 
 import info.globalcode.sql.dk.Parameter;
-import java.io.OutputStream;
 import java.util.EmptyStackException;
 import java.util.EnumSet;
 import java.util.List;
@@ -31,13 +30,13 @@
 public abstract class AbstractFormatter implements Formatter {
 
 	private Stack<State> state = new Stack<>();
-	private OutputStream outputStream;
+	private FormatterContext formatterContext;
 	private ColumnsHeader currentColumnsHeader;
 	private String currentQuery;
 	private int currentColumnsCount;
 
-	public AbstractFormatter(OutputStream outputStream) {
-		this.outputStream = outputStream;
+	public AbstractFormatter(FormatterContext formatterContext) {
+		this.formatterContext = formatterContext;
 		state.push(State.ROOT);
 	}
 
@@ -224,8 +223,8 @@
 		popState(EnumSet.of(State.UPDATES_RESULT));
 	}
 
-	protected OutputStream getOutputStream() {
-		return outputStream;
+	public FormatterContext getFormatterContext() {
+		return formatterContext;
 	}
 
 	protected ColumnsHeader getCurrentColumnsHeader() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/FormatterContext.java	Fri Dec 20 22:58:02 2013 +0100
@@ -0,0 +1,37 @@
+/**
+ * SQL-DK
+ * Copyright © 2013 František Kučera (frantovo.cz)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package info.globalcode.sql.dk.formatting;
+
+import java.io.OutputStream;
+
+/**
+ *
+ * @author Ing. František Kučera (frantovo.cz)
+ */
+public class FormatterContext {
+
+	private OutputStream outputStream;
+
+	public FormatterContext(OutputStream outputStream) {
+		this.outputStream = outputStream;
+	}
+
+	public OutputStream getOutputStream() {
+		return outputStream;
+	}
+}