1 /*
2 * XML Format Maven Plugin (https://github.com/acegi/xml-format-maven-plugin)
3 *
4 * Copyright 2011-2025 Acegi Technology Pty Limited.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * https://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package au.com.acegi.xmlformat;
19
20 /**
21 * Valid line endings for use by {@link XmlFormatPlugin#lineEnding}.
22 */
23 public enum LineEnding {
24
25 /**
26 * Use the system default line ending.
27 */
28 SYSTEM(),
29
30 /**
31 * Use the newline character. Typical on Unix and Unix-like systems.
32 */
33 LF("\n"),
34
35 /**
36 * Use the carriage return and new line characters. Typical on Windows.
37 */
38 CRLF("\r\n"),
39
40 /**
41 * Use the carriage return character.
42 */
43 CR("\r");
44
45 private final String chars;
46
47 LineEnding() {
48 this.chars = System.lineSeparator();
49 }
50
51 LineEnding(final String value) {
52 this.chars = value;
53 }
54
55 /**
56 * Gets the chars.
57 *
58 * @return the chars
59 */
60 public String getChars() {
61 return this.chars;
62 }
63
64 }