formatter: FormatterContext v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Fri, 20 Dec 2013 22:58:02 +0100
branchv_0
changeset 2465e3fffae091
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
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractFormatter.java	Fri Dec 20 22:19:10 2013 +0100
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractFormatter.java	Fri Dec 20 22:58:02 2013 +0100
     1.3 @@ -18,7 +18,6 @@
     1.4  package info.globalcode.sql.dk.formatting;
     1.5  
     1.6  import info.globalcode.sql.dk.Parameter;
     1.7 -import java.io.OutputStream;
     1.8  import java.util.EmptyStackException;
     1.9  import java.util.EnumSet;
    1.10  import java.util.List;
    1.11 @@ -31,13 +30,13 @@
    1.12  public abstract class AbstractFormatter implements Formatter {
    1.13  
    1.14  	private Stack<State> state = new Stack<>();
    1.15 -	private OutputStream outputStream;
    1.16 +	private FormatterContext formatterContext;
    1.17  	private ColumnsHeader currentColumnsHeader;
    1.18  	private String currentQuery;
    1.19  	private int currentColumnsCount;
    1.20  
    1.21 -	public AbstractFormatter(OutputStream outputStream) {
    1.22 -		this.outputStream = outputStream;
    1.23 +	public AbstractFormatter(FormatterContext formatterContext) {
    1.24 +		this.formatterContext = formatterContext;
    1.25  		state.push(State.ROOT);
    1.26  	}
    1.27  
    1.28 @@ -224,8 +223,8 @@
    1.29  		popState(EnumSet.of(State.UPDATES_RESULT));
    1.30  	}
    1.31  
    1.32 -	protected OutputStream getOutputStream() {
    1.33 -		return outputStream;
    1.34 +	public FormatterContext getFormatterContext() {
    1.35 +		return formatterContext;
    1.36  	}
    1.37  
    1.38  	protected ColumnsHeader getCurrentColumnsHeader() {
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/FormatterContext.java	Fri Dec 20 22:58:02 2013 +0100
     2.3 @@ -0,0 +1,37 @@
     2.4 +/**
     2.5 + * SQL-DK
     2.6 + * Copyright © 2013 František Kučera (frantovo.cz)
     2.7 + *
     2.8 + * This program is free software: you can redistribute it and/or modify
     2.9 + * it under the terms of the GNU General Public License as published by
    2.10 + * the Free Software Foundation, either version 3 of the License, or
    2.11 + * (at your option) any later version.
    2.12 + *
    2.13 + * This program is distributed in the hope that it will be useful,
    2.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    2.16 + * GNU General Public License for more details.
    2.17 + *
    2.18 + * You should have received a copy of the GNU General Public License
    2.19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    2.20 + */
    2.21 +package info.globalcode.sql.dk.formatting;
    2.22 +
    2.23 +import java.io.OutputStream;
    2.24 +
    2.25 +/**
    2.26 + *
    2.27 + * @author Ing. František Kučera (frantovo.cz)
    2.28 + */
    2.29 +public class FormatterContext {
    2.30 +
    2.31 +	private OutputStream outputStream;
    2.32 +
    2.33 +	public FormatterContext(OutputStream outputStream) {
    2.34 +		this.outputStream = outputStream;
    2.35 +	}
    2.36 +
    2.37 +	public OutputStream getOutputStream() {
    2.38 +		return outputStream;
    2.39 +	}
    2.40 +}