public interface TypedConfigGetter
Config
to typed values.Modifier and Type | Method and Description |
---|---|
boolean |
getBoolean(Config config,
String section,
String subsection,
String name,
boolean defaultValue)
Get a boolean value from a git
Config . |
<T extends Enum<?>> |
getEnum(Config config,
T[] all,
String section,
String subsection,
String name,
T defaultValue)
Parse an enumeration from a git
Config . |
int |
getInt(Config config,
String section,
String subsection,
String name,
int defaultValue)
Obtain an integer value from a git
Config . |
long |
getLong(Config config,
String section,
String subsection,
String name,
long defaultValue)
Obtain a long value from a git
Config . |
default Path |
getPath(Config config,
String section,
String subsection,
String name,
FS fs,
File resolveAgainst,
Path defaultValue)
Parse a string value from a git
Config and treat it as a file
path, replacing a ~/ prefix by the user's home directory. |
List<RefSpec> |
getRefSpecs(Config config,
String section,
String subsection,
String name)
|
long |
getTimeUnit(Config config,
String section,
String subsection,
String name,
long defaultValue,
TimeUnit wantUnit)
Parse a numerical time unit, such as "1 minute", from a git
Config . |
boolean getBoolean(Config config, String section, String subsection, String name, boolean defaultValue)
Config
.config
- to get the value fromsection
- section the key is grouped within.subsection
- subsection name, such a remote or branch name.name
- name of the key to get.defaultValue
- default value to return if no value was present.<T extends Enum<?>> T getEnum(Config config, T[] all, String section, String subsection, String name, T defaultValue)
Config
.config
- to get the value fromall
- all possible values in the enumeration which should be
recognized. Typically EnumType.values()
.section
- section the key is grouped within.subsection
- subsection name, such a remote or branch name.name
- name of the key to get.defaultValue
- default value to return if no value was present.defaultValue
.int getInt(Config config, String section, String subsection, String name, int defaultValue)
Config
.config
- to get the value fromsection
- section the key is grouped within.subsection
- subsection name, such a remote or branch name.name
- name of the key to get.defaultValue
- default value to return if no value was present.long getLong(Config config, String section, String subsection, String name, long defaultValue)
Config
.config
- to get the value fromsection
- section the key is grouped within.subsection
- subsection name, such a remote or branch name.name
- name of the key to get.defaultValue
- default value to return if no value was present.long getTimeUnit(Config config, String section, String subsection, String name, long defaultValue, TimeUnit wantUnit)
Config
.config
- to get the value fromsection
- section the key is in.subsection
- subsection the key is in, or null if not in a subsection.name
- the key name.defaultValue
- default value to return if no value was present.wantUnit
- the units of defaultValue
and the return value, as
well as the units to assume if the value does not contain an
indication of the units.defaultValue
if not set, expressed in
units
.default Path getPath(Config config, String section, String subsection, String name, @NonNull FS fs, File resolveAgainst, Path defaultValue)
Config
and treat it as a file
path, replacing a ~/ prefix by the user's home directory.
Note: this may throw InvalidPathException
if the string is
not a valid path.
config
- to get the path from.section
- section the key is in.subsection
- subsection the key is in, or null if not in a subsection.name
- the key name.fs
- to use to convert the string into a path.resolveAgainst
- directory to resolve the path against if it is a relative
path.defaultValue
- to return if no value was presentPath
, or defaultValue
if not set@NonNull List<RefSpec> getRefSpecs(Config config, String section, String subsection, String name)
config
- to get the list fromsection
- section the key is in.subsection
- subsection the key is in, or null if not in a subsection.name
- the key name.RefSpec
sCopyright © 2020 Eclipse JGit Project. All rights reserved.