public enum LineEndOption extends java.lang.Enum<LineEndOption>
This class encapsulates the options for the character or characters which constitute the end of a line. There are the explicit options such as UNIX as well as the option to take the characters from the system property (line.separator).
The explicit options of this enumeration and the values in the LineEndType enumeration correspond one-to-one, as the line-endings one should be able to choose explicitly are the same ones that are supported. But also, and that is the point of having this class in addition to LineEndType, one might reasonably want to specify how the line ending to be used is to be determined. There is only one scheme for this so far which is to get it from the appropriate system property. That's the same scheme that is used in the java.io.PrintStream.println function, although LineEndOption performs validation while PrintStream.println appeared not to do any, at least not in my experiments.
Enum Constant and Description |
---|
MAC |
SYSTEM_PROPERTY
This will end with the same characters as one of the other options.
|
UNIX |
WINDOWS |
Modifier and Type | Field and Description |
---|---|
java.lang.String |
_fullDescription
_lineEndType + " (" + explanation_how_lineEndType_was_assigned + ")"
|
java.lang.String |
_label |
java.lang.String |
_lineEndStr
Same as _lineEndType._lineEndStr
|
LineEndType |
_lineEndType |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
toString() |
static LineEndOption |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static LineEndOption[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final LineEndOption UNIX
public static final LineEndOption WINDOWS
public static final LineEndOption MAC
public static final LineEndOption SYSTEM_PROPERTY
This will end with the same characters as one of the other options. If the system property @see LINE_END_SYSTEM_PROPERTY_NAME does not have characters matching any of the other options, or if the property is missing, the line ending will be defaulted.
As this type is immutable, once it is loaded, any subsequent changes to the system property will have no effect.
The thought occurred to me to have a different system properties option for each LineEndType to take that LineEndType as a default, but then I decided it was overkill because the system property is always going to be present and correct unless somebody deliberately makes it not so (as I did in my tests).
public final java.lang.String _label
public final java.lang.String _lineEndStr
public final LineEndType _lineEndType
public final java.lang.String _fullDescription
public static LineEndOption[] values()
for (LineEndOption c : LineEndOption.values()) System.out.println(c);
public static LineEndOption valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified namejava.lang.NullPointerException
- if the argument is nullpublic java.lang.String toString()
toString
in class java.lang.Enum<LineEndOption>