Class Settings
java.lang.Object
de.Keyle.MyPet.api.util.configuration.settings.Settings
Parsed key=value bag from a Requirement or LeashFlag string like
"MinHealth:min=20:max=50". Typed accessors do the parsing so
callers never touch raw strings or write their own try/catch.
The parser distinguishes two token shapes:
- Keyed (
k=v, e.g."min=20") — reachable by case-insensitive name viagetInt(String),getDouble(String),getString(String),getBoolean(String),contains(String),get(String). - Positional (no
=, e.g."50%") — reachable only by iteratingentries().
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReports whether ak=ventry exists forkey, case-insensitively.entries()Unmodifiable view of every parsed entry in input order, including positional tokens.Looks up thek=ventry forkey, case-insensitively.getBoolean(String key) Parses the value ofkey=vas a boolean, accepting only"true"and"false".Parses the value ofkey=vas a double.Parses the value ofkey=vas an int.getName()Returns the flag or requirement these settings belong to.Returns the raw string value ofkey=v.voidParse a settings string (everything after the leading flag name and its first colon — e.g.
-
Constructor Details
-
Settings
Creates an empty bag for the named flag or requirement. Callload(String)to populate it.- Parameters:
flagName- the flag or requirement these settings belong to
-
-
Method Details
-
getName
Returns the flag or requirement these settings belong to.- Returns:
- the name passed to the constructor
-
load
Parse a settings string (everything after the leading flag name and its first colon — e.g."min=20:max=50"or"50%"). Tokens of the formk=vbecome keyed entries; tokens without=become positional entries.- Parameters:
settingsString- the colon-separated token list
-
contains
Reports whether ak=ventry exists forkey, case-insensitively.- Parameters:
key- the key to look for- Returns:
trueif a keyed entry exists
-
get
Looks up thek=ventry forkey, case-insensitively.- Parameters:
key- the key to look for- Returns:
- the entry, or empty if there is none
-
getInt
Parses the value ofkey=vas an int.- Parameters:
key- the key to read- Returns:
- the parsed value, or empty if absent or unparseable
-
getDouble
Parses the value ofkey=vas a double.- Parameters:
key- the key to read- Returns:
- the parsed value, or empty if absent or unparseable
-
getBoolean
Parses the value ofkey=vas a boolean, accepting only"true"and"false".- Parameters:
key- the key to read- Returns:
- the parsed value, or empty if absent or anything else
-
getString
Returns the raw string value ofkey=v.- Parameters:
key- the key to read- Returns:
- the value, or empty if the key is absent
-
entries
Unmodifiable view of every parsed entry in input order, including positional tokens. Use this when the parsing logic doesn't fit a single keyed lookup (positional values, suffix detection, multi-value iteration).- Returns:
- every parsed entry, in input order
-