Enum ParsingMode
- java.lang.Object
-
- java.lang.Enum<ParsingMode>
-
- com.electronwill.nightconfig.core.io.ParsingMode
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<ParsingMode>
public enum ParsingMode extends java.lang.Enum<ParsingMode>
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ADDAdds the parsed values to the config: the existing values are prioritary and will not be replaced.MERGEMerges the parsed config with the existing one: the parsed values are prioritary.REPLACEReplaces the existing config by the parsed one.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidprepareParsing(Config config)Prepare the config to be parsed with this mode.java.lang.Objectput(Config config, java.lang.String key, java.lang.Object value)Puts (set or add) a value into the configjava.lang.Objectput(Config config, java.util.List<java.lang.String> key, java.lang.Object value)Puts (set or add) a value into the configjava.lang.Objectput(java.util.Map<java.lang.String,java.lang.Object> map, java.lang.String key, java.lang.Object value)Puts (set or add) a value into the configstatic ParsingModevalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static ParsingMode[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
REPLACE
public static final ParsingMode REPLACE
Replaces the existing config by the parsed one.
-
MERGE
public static final ParsingMode MERGE
Merges the parsed config with the existing one: the parsed values are prioritary. This mode performs a shallow merge, not a deep one.
-
ADD
public static final ParsingMode ADD
Adds the parsed values to the config: the existing values are prioritary and will not be replaced.
-
-
Method Detail
-
values
public static ParsingMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ParsingMode c : ParsingMode.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ParsingMode valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
prepareParsing
public void prepareParsing(Config config)
Prepare the config to be parsed with this mode. This method is called before the parsed data is put into the config.- Parameters:
config- the config that will be parsed
-
put
public java.lang.Object put(Config config, java.util.List<java.lang.String> key, java.lang.Object value)
Puts (set or add) a value into the config- Returns:
- the previous value if any, or null if none
-
put
public java.lang.Object put(Config config, java.lang.String key, java.lang.Object value)
Puts (set or add) a value into the config- Returns:
- the previous value if any, or null if none
-
put
public java.lang.Object put(java.util.Map<java.lang.String,java.lang.Object> map, java.lang.String key, java.lang.Object value)Puts (set or add) a value into the config- Returns:
- the previous value if any, or null if none
-
-