Top Description Fields Methods
org.eclipse.jgit.lib

public Interface TypedConfigGetter

Known Direct Implementers
org.eclipse.jgit.lib.DefaultTypedConfigGetter
Imports
java.io.File, java.nio.file.InvalidPathException, .Path, java.util.List, java.util.concurrent.TimeUnit, org.eclipse.jgit.annotations.NonNull, .Nullable, org.eclipse.jgit.transport.RefSpec, org.eclipse.jgit.util.FS

Something that knows how to convert plain strings from a git Config to typed values.
Since
4.9

Field Summary

Modifier and TypeField and Description
public static final int
UNSET_INT

Use Integer#MIN_VALUE as unset int value

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if any value or defaultValue is true, false for missing or explicit false
getBoolean
(Config
to get the value from
config
,
String
section the key is grouped within.
section
,
String
subsection name, such a remote or branch name.
subsection
,
String
name of the key to get.
name
,
boolean
default value to return if no value was present.
defaultValue
)

Get a boolean value from a git Config.

public Boolean

Returns:

true if any value or defaultValue is true, false for missing or explicit false
getBoolean
(Config
to get the value from
config
,
String
section the key is grouped within.
section
,
String
subsection name, such a remote or branch name.
subsection
,
String
name of the key to get.
name
,
Boolean
default value to return if no value was present.
defaultValue
)

Get a boolean value from a git Config.

public <
type of the enum
T extends Enum<?>
>
T

Returns:

the selected enumeration value, or defaultValue.
getEnum
(Config
to get the value from
config
,
T[]
all possible values in the enumeration which should be recognized. Typically EnumType.values().
all
,
String
section the key is grouped within.
section
,
String
subsection name, such a remote or branch name.
subsection
,
String
name of the key to get.
name
,
T
default value to return if no value was present.
defaultValue
)

Parse an enumeration from a git Config.

public int

Returns:

an integer value from the configuration, or defaultValue.
getInt
(Config
to get the value from
config
,
String
section the key is grouped within.
section
,
String
subsection name, such a remote or branch name.
subsection
,
String
name of the key to get.
name
,
int
default value to return if no value was present.
defaultValue
)

Obtain an integer value from a git Config.

public Integer

Returns:

an integer value from the configuration, or defaultValue.
getInt
(Config
to get the value from
config
,
String
section the key is grouped within.
section
,
String
subsection name, such a remote or branch name.
subsection
,
String
name of the key to get.
name
,
Integer
default value to return if no value was present.
defaultValue
)

Obtain an integer value from a git Config.

public int

Returns:

an integer value from the configuration, or defaultValue. #UNSET_INT if unset.
getIntInRange
(Config
to get the value from
config
,
String
section the key is grouped within.
section
,
String
subsection name, such a remote or branch name.
subsection
,
String
name of the key to get.
name
,
int
minimal value
minValue
,
int
maximum value
maxValue
,
int
default value to return if no value was present. Use #UNSET_INT to set the default to unset.
defaultValue
)

Obtain an integer value from a git Config which must be in given range.

public Integer

Returns:

an integer value from the configuration, or defaultValue. #UNSET_INT if unset.
getIntInRange
(Config
to get the value from
config
,
String
section the key is grouped within.
section
,
String
subsection name, such a remote or branch name.
subsection
,
String
name of the key to get.
name
,
int
minimal value
minValue
,
int
maximum value
maxValue
,
Integer
default value to return if no value was present. Use #UNSET_INT to set the default to unset.
defaultValue
)

Obtain an integer value from a git Config which must be in given range.

public long

Returns:

a long value from the configuration, or defaultValue.
getLong
(Config
to get the value from
config
,
String
section the key is grouped within.
section
,
String
subsection name, such a remote or branch name.
subsection
,
String
name of the key to get.
name
,
long
default value to return if no value was present.
defaultValue
)

Obtain a long value from a git Config.

public Long

Returns:

a long value from the configuration, or defaultValue.
getLong
(Config
to get the value from
config
,
String
section the key is grouped within.
section
,
String
subsection name, such a remote or branch name.
subsection
,
String
name of the key to get.
name
,
Long
default value to return if no value was present.
defaultValue
)

Obtain a long value from a git Config.

public default Path

Returns:

the Path, or defaultValue if not set
getPath
(Config
to get the path from.
config
,
String
section the key is in.
section
,
String
subsection the key is in, or null if not in a subsection.
subsection
,
String
the key name.
name
,
FS
to use to convert the string into a path.
fs
,
File
directory to resolve the path against if it is a relative path.
resolveAgainst
,
Path
to return if no value was present
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.

public List<RefSpec>

Returns:

a possibly empty list of org.eclipse.jgit.transport.RefSpecs
getRefSpecs
(Config
to get the list from
config
,
String
section the key is in.
section
,
String
subsection the key is in, or null if not in a subsection.
subsection
,
String
the key name.
name
)

Parse a list of RefSpecs from a git Config.

public long

Returns:

the value, or defaultValue if not set, expressed in units.
getTimeUnit
(Config
to get the value from
config
,
String
section the key is in.
section
,
String
subsection the key is in, or null if not in a subsection.
subsection
,
String
the key name.
name
,
long
default value to return if no value was present.
defaultValue
,
TimeUnit
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.
wantUnit
)

Parse a numerical time unit, such as "1 minute", from a git Config.

public Long

Returns:

the value, or defaultValue if not set, expressed in units.
getTimeUnit
(Config
to get the value from
config
,
String
section the key is in.
section
,
String
subsection the key is in, or null if not in a subsection.
subsection
,
String
the key name.
name
,
Long
default value to return if no value was present.
defaultValue
,
TimeUnit
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.
wantUnit
)

Parse a numerical time unit, such as "1 minute", from a git Config.

Field Detail

UNSET_INTback to summary
public static final int UNSET_INT

Use Integer#MIN_VALUE as unset int value

Since
6.1

Method Detail

getBooleanback to summary
public boolean getBoolean(Config config, String section, String subsection, String name, boolean defaultValue)

Get a boolean value from a git Config.

Parameters
config:Config

to get the value from

section:String

section the key is grouped within.

subsection:String

subsection name, such a remote or branch name.

name:String

name of the key to get.

defaultValue:boolean

default value to return if no value was present.

Returns:boolean

true if any value or defaultValue is true, false for missing or explicit false

Annotations
@Deprecated
getBooleanback to summary
public Boolean getBoolean(Config config, String section, String subsection, String name, Boolean defaultValue)

Get a boolean value from a git Config.

Parameters
config:Config

to get the value from

section:String

section the key is grouped within.

subsection:String

subsection name, such a remote or branch name.

name:String

name of the key to get.

defaultValue:Boolean

default value to return if no value was present.

Returns:Boolean

true if any value or defaultValue is true, false for missing or explicit false

Annotations
@Nullable
Since
7.2
getEnumback to summary
public <T extends Enum<?>> T getEnum(Config config, T[] all, String section, String subsection, String name, T defaultValue)

Parse an enumeration from a git Config.

Parameters
<T>
type of the enum
config:Config

to get the value from

all:T[]

all possible values in the enumeration which should be recognized. Typically EnumType.values().

section:String

section the key is grouped within.

subsection:String

subsection name, such a remote or branch name.

name:String

name of the key to get.

defaultValue:T

default value to return if no value was present.

Returns:T

the selected enumeration value, or defaultValue.

Annotations
@Nullable
getIntback to summary
public int getInt(Config config, String section, String subsection, String name, int defaultValue)

Obtain an integer value from a git Config.

Parameters
config:Config

to get the value from

section:String

section the key is grouped within.

subsection:String

subsection name, such a remote or branch name.

name:String

name of the key to get.

defaultValue:int

default value to return if no value was present.

Returns:int

an integer value from the configuration, or defaultValue.

Annotations
@Deprecated
getIntback to summary
public Integer getInt(Config config, String section, String subsection, String name, Integer defaultValue)

Obtain an integer value from a git Config.

Parameters
config:Config

to get the value from

section:String

section the key is grouped within.

subsection:String

subsection name, such a remote or branch name.

name:String

name of the key to get.

defaultValue:Integer

default value to return if no value was present.

Returns:Integer

an integer value from the configuration, or defaultValue.

Annotations
@Nullable
Since
7.2
getIntInRangeback to summary
public int getIntInRange(Config config, String section, String subsection, String name, int minValue, int maxValue, int defaultValue)

Obtain an integer value from a git Config which must be in given range.

Parameters
config:Config

to get the value from

section:String

section the key is grouped within.

subsection:String

subsection name, such a remote or branch name.

name:String

name of the key to get.

minValue:int

minimal value

maxValue:int

maximum value

defaultValue:int

default value to return if no value was present. Use #UNSET_INT to set the default to unset.

Returns:int

an integer value from the configuration, or defaultValue. #UNSET_INT if unset.

Annotations
@Deprecated
Since
6.1
getIntInRangeback to summary
public Integer getIntInRange(Config config, String section, String subsection, String name, int minValue, int maxValue, Integer defaultValue)

Obtain an integer value from a git Config which must be in given range.

Parameters
config:Config

to get the value from

section:String

section the key is grouped within.

subsection:String

subsection name, such a remote or branch name.

name:String

name of the key to get.

minValue:int

minimal value

maxValue:int

maximum value

defaultValue:Integer

default value to return if no value was present. Use #UNSET_INT to set the default to unset.

Returns:Integer

an integer value from the configuration, or defaultValue. #UNSET_INT if unset.

Annotations
@Nullable
Since
7.2
getLongback to summary
public long getLong(Config config, String section, String subsection, String name, long defaultValue)

Obtain a long value from a git Config.

Parameters
config:Config

to get the value from

section:String

section the key is grouped within.

subsection:String

subsection name, such a remote or branch name.

name:String

name of the key to get.

defaultValue:long

default value to return if no value was present.

Returns:long

a long value from the configuration, or defaultValue.

Annotations
@Deprecated
getLongback to summary
public Long getLong(Config config, String section, String subsection, String name, Long defaultValue)

Obtain a long value from a git Config.

Parameters
config:Config

to get the value from

section:String

section the key is grouped within.

subsection:String

subsection name, such a remote or branch name.

name:String

name of the key to get.

defaultValue:Long

default value to return if no value was present.

Returns:Long

a long value from the configuration, or defaultValue.

Annotations
@Nullable
Since
7.2
getPathback to summary
public 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.

Note

this may throw InvalidPathException if the string is not a valid path.

Parameters
config:Config

to get the path from.

section:String

section the key is in.

subsection:String

subsection the key is in, or null if not in a subsection.

name:String

the key name.

fs:FS

to use to convert the string into a path.

resolveAgainst:File

directory to resolve the path against if it is a relative path.

defaultValue:Path

to return if no value was present

Returns:Path

the Path, or defaultValue if not set

Annotations
@Nullable
Since
5.10
getRefSpecsback to summary
public List<RefSpec> getRefSpecs(Config config, String section, String subsection, String name)

Parse a list of RefSpecs from a git Config.

Parameters
config:Config

to get the list from

section:String

section the key is in.

subsection:String

subsection the key is in, or null if not in a subsection.

name:String

the key name.

Returns:List<RefSpec>

a possibly empty list of org.eclipse.jgit.transport.RefSpecs

Annotations
@NonNull
getTimeUnitback to summary
public 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.

Parameters
config:Config

to get the value from

section:String

section the key is in.

subsection:String

subsection the key is in, or null if not in a subsection.

name:String

the key name.

defaultValue:long

default value to return if no value was present.

wantUnit:TimeUnit

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.

Returns:long

the value, or defaultValue if not set, expressed in units.

Annotations
@Deprecated
getTimeUnitback to summary
public 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.

Parameters
config:Config

to get the value from

section:String

section the key is in.

subsection:String

subsection the key is in, or null if not in a subsection.

name:String

the key name.

defaultValue:Long

default value to return if no value was present.

wantUnit:TimeUnit

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.

Returns:Long

the value, or defaultValue if not set, expressed in units.

Annotations
@Nullable
Since
7.2