# HG changeset patch # User František Kučera # Date 1387576682 -3600 # Node ID 65e3fffae09105c3f26e3e343be7720fc6f95458 # Parent d8faf91519a513ff023d974cc53d75ca3de49eb7 formatter: FormatterContext diff -r d8faf91519a5 -r 65e3fffae091 java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractFormatter.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 = 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() { diff -r d8faf91519a5 -r 65e3fffae091 java/sql-dk/src/info/globalcode/sql/dk/formatting/FormatterContext.java --- /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 . + */ +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; + } +}