~ubuntu-branches/ubuntu/raring/apgdiff/raring

« back to all changes in this revision

Viewing changes to src/main/java/cz/startnet/utils/pgdiff/SearchPathHelper.java

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2010-10-11 09:08:18 UTC
  • mfrom: (2.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20101011090818-sdw8yfemrnxo328k
Tags: 2.2.2-1
* New upstream version.
* Using changelog included in zipfile, thanks Miroslav for providing this.
* Update manpage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * Copyright 2010 StartNet s.r.o.
 
3
 */
 
4
package cz.startnet.utils.pgdiff;
 
5
 
 
6
import java.io.PrintWriter;
 
7
 
 
8
/**
 
9
 * Helps to output search path only if it was not output yet.
 
10
 * 
 
11
 * @author fordfrog
 
12
 */
 
13
public class SearchPathHelper {
 
14
 
 
15
    /**
 
16
     * Statement to output.
 
17
     */
 
18
    private final String searchPath;
 
19
    /**
 
20
     * Flag determining whether the statement was already output.
 
21
     */
 
22
    private boolean wasOutput;
 
23
 
 
24
    /**
 
25
     * Creates new instance of SearchPathHelper.
 
26
     *
 
27
     * @param searchPath {@link #searchPath}
 
28
     */
 
29
    public SearchPathHelper(final String searchPath) {
 
30
        this.searchPath = searchPath;
 
31
    }
 
32
 
 
33
    /**
 
34
     * Outputs search path if it was not output yet.
 
35
     *
 
36
     * @param writer writer
 
37
     */
 
38
    public void outputSearchPath(final PrintWriter writer) {
 
39
        if (!wasOutput && searchPath != null && !searchPath.isEmpty()) {
 
40
            writer.println();
 
41
            writer.println(searchPath);
 
42
            wasOutput = true;
 
43
        }
 
44
    }
 
45
}