001: /***** BEGIN LICENSE BLOCK *****
002: * Version: CPL 1.0/GPL 2.0/LGPL 2.1
003: *
004: * The contents of this file are subject to the Common Public
005: * License Version 1.0 (the "License"); you may not use this file
006: * except in compliance with the License. You may obtain a copy of
007: * the License at http://www.eclipse.org/legal/cpl-v10.html
008: *
009: * Software distributed under the License is distributed on an "AS
010: * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
011: * implied. See the License for the specific language governing
012: * rights and limitations under the License.
013: *
014: * Copyright (C) 2007 Ola Bini <ola@ologix.com>
015: *
016: * Alternatively, the contents of this file may be used under the terms of
017: * either of the GNU General Public License Version 2 or later (the "GPL"),
018: * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
019: * in which case the provisions of the GPL or the LGPL are applicable instead
020: * of those above. If you wish to allow use of your version of this file only
021: * under the terms of either the GPL or the LGPL, and not to allow others to
022: * use your version of this file under the terms of the CPL, indicate your
023: * decision by deleting the provisions above and replace them with the notice
024: * and other provisions required by the GPL or the LGPL. If you do not delete
025: * the provisions above, a recipient may use your version of this file under
026: * the terms of any one of the CPL, the GPL or the LGPL.
027: ***** END LICENSE BLOCK *****/package org.jvyamlb;
028:
029: /**
030: * @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
031: */
032: public class DefaultYAMLConfig implements YAMLConfig {
033: private int indent = 2;
034: private boolean useHeader = false;
035: private boolean useVersion = false;
036: private String version = "1.1";
037: private boolean expStart = true;
038: private boolean expEnd = false;
039: private String format = "id{0,number,000}";
040: private boolean expTypes = false;
041: private boolean canonical = false;
042: private int bestWidth = 80;
043: private boolean useBlock = false;
044: private boolean useFlow = false;
045: private boolean usePlain = false;
046: private boolean useSingle = false;
047: private boolean useDouble = false;
048:
049: public YAMLConfig indent(final int indent) {
050: this .indent = indent;
051: return this ;
052: }
053:
054: public int indent() {
055: return this .indent;
056: }
057:
058: public YAMLConfig useHeader(final boolean useHeader) {
059: this .useHeader = useHeader;
060: return this ;
061: }
062:
063: public boolean useHeader() {
064: return this .useHeader;
065: }
066:
067: public YAMLConfig useVersion(final boolean useVersion) {
068: this .useVersion = useVersion;
069: return this ;
070: }
071:
072: public boolean useVersion() {
073: return this .useVersion;
074: }
075:
076: public YAMLConfig version(final String version) {
077: this .version = version;
078: return this ;
079: }
080:
081: public String version() {
082: return this .version;
083: }
084:
085: public YAMLConfig explicitStart(final boolean expStart) {
086: this .expStart = expStart;
087: return this ;
088: }
089:
090: public boolean explicitStart() {
091: return this .expStart;
092: }
093:
094: public YAMLConfig explicitEnd(final boolean expEnd) {
095: this .expEnd = expEnd;
096: return this ;
097: }
098:
099: public boolean explicitEnd() {
100: return this .expEnd;
101: }
102:
103: public YAMLConfig anchorFormat(final String format) {
104: this .format = format;
105: return this ;
106: }
107:
108: public String anchorFormat() {
109: return this .format;
110: }
111:
112: public YAMLConfig explicitTypes(final boolean expTypes) {
113: this .expTypes = expTypes;
114: return this ;
115: }
116:
117: public boolean explicitTypes() {
118: return this .expTypes;
119: }
120:
121: public YAMLConfig canonical(final boolean canonical) {
122: this .canonical = canonical;
123: return this ;
124: }
125:
126: public boolean canonical() {
127: return this .canonical;
128: }
129:
130: public YAMLConfig bestWidth(final int bestWidth) {
131: this .bestWidth = bestWidth;
132: return this ;
133: }
134:
135: public int bestWidth() {
136: return this .bestWidth;
137: }
138:
139: public YAMLConfig useBlock(final boolean useBlock) {
140: this .useBlock = useBlock;
141: return this ;
142: }
143:
144: public boolean useBlock() {
145: return this .useBlock;
146: }
147:
148: public YAMLConfig useFlow(final boolean useFlow) {
149: this .useFlow = useFlow;
150: return this ;
151: }
152:
153: public boolean useFlow() {
154: return this .useFlow;
155: }
156:
157: public YAMLConfig usePlain(final boolean usePlain) {
158: this .usePlain = usePlain;
159: return this ;
160: }
161:
162: public boolean usePlain() {
163: return this .usePlain;
164: }
165:
166: public YAMLConfig useSingle(final boolean useSingle) {
167: this .useSingle = useSingle;
168: return this ;
169: }
170:
171: public boolean useSingle() {
172: return this .useSingle;
173: }
174:
175: public YAMLConfig useDouble(final boolean useDouble) {
176: this .useDouble = useDouble;
177: return this ;
178: }
179:
180: public boolean useDouble() {
181: return this .useDouble;
182: }
183: }// DefaultYAMLConfig
|