source: josm/trunk/src/org/openstreetmap/josm/io/OsmWriterFactory.java@ 10194

Last change on this file since 10194 was 8510, checked in by Don-vip, 9 years ago

checkstyle: enable relevant whitespace checks and fix them

  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.io;
3
4import java.io.PrintWriter;
5
6/**
7 * This factory is called by everyone who needs an OsmWriter object,
8 * instead of directly calling the OsmWriter constructor.
9 *
10 * This enables plugins to substitute the original OsmWriter with
11 * their own version, altering the way JOSM writes objects to the
12 * server, and to disk.
13 *
14 * @author Frederik Ramm
15 *
16 */
17public class OsmWriterFactory {
18
19 public static volatile OsmWriterFactory theFactory;
20 public static OsmWriter createOsmWriter(PrintWriter out, boolean osmConform, String version) {
21 // pre-set factory with this default implementation; can still be overwritten
22 // later. note that the default factory may already be used for constructing
23 // OsmWriters during the startup process.
24 if (theFactory == null) {
25 theFactory = new OsmWriterFactory();
26 }
27 return theFactory.createOsmWriterImpl(out, osmConform, version);
28 }
29
30 protected OsmWriter createOsmWriterImpl(PrintWriter out, boolean osmConform, String version) {
31 return new OsmWriter(out, osmConform, version);
32 }
33}
Note: See TracBrowser for help on using the repository browser.