Top Description Constructors Methods
org.eclipse.jgit.lib

public Class DefaultTypedConfigGetter

extends Object
implements TypedConfigGetter
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.lib.TypedConfigGetter
Imports
java.text.MessageFormat, java.util.ArrayList, .List, java.util.concurrent.TimeUnit, java.util.regex.Matcher, .Pattern, org.eclipse.jgit.annotations.NonNull, .Nullable, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.lib.Config.ConfigEnum, org.eclipse.jgit.transport.RefSpec, org.eclipse.jgit.util.StringUtils

An org.eclipse.jgit.lib.TypedConfigGetter that throws java.lang.IllegalArgumentException on invalid values.
Since
4.9

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
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
)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getBoolean.

Get a boolean value from a git Config.

public Boolean
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
)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getBoolean.

Get a boolean value from a git Config.

public <T extends Enum<?>> T
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
)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getEnum.

Parse an enumeration from a git Config.

public int
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
)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getInt.

Obtain an integer value from a git Config.

public Integer
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
)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getInt.

Obtain an integer value from a git Config.

public int
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
)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getIntInRange.

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

public Integer
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
)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getIntInRange.

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

public long
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
)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getLong.

Obtain a long value from a git Config.

public Long
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
)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getLong.

Obtain a long value from a git Config.

public List<RefSpec>
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
)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getRefSpecs.

Parse a list of RefSpecs from a git Config.

public long
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
)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getTimeUnit.

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

public Long
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
)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getTimeUnit.

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

private static boolean
match(String a, String... cases)

private static <T> T
neverNull(T one)

private static IllegalArgumentException
notTimeUnit(String section, String subsection, String name, String valueString)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

DefaultTypedConfigGetterback to summary
public DefaultTypedConfigGetter()

Method Detail

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

Implements org.eclipse.jgit.lib.TypedConfigGetter.getBoolean.

Doc from org.eclipse.jgit.lib.TypedConfigGetter.getBoolean.

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
@SuppressWarnings:boxed
@Override
getBooleanback to summary
public Boolean getBoolean(Config config, String section, String subsection, String name, Boolean defaultValue)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getBoolean.

Doc from org.eclipse.jgit.lib.TypedConfigGetter.getBoolean.

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
@Override
getEnumback to summary
public <T extends Enum<?>> T getEnum(Config config, T[] all, String section, String subsection, String name, T defaultValue)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getEnum.

Doc from org.eclipse.jgit.lib.TypedConfigGetter.getEnum.

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
@Override
getIntback to summary
public int getInt(Config config, String section, String subsection, String name, int defaultValue)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getInt.

Doc from org.eclipse.jgit.lib.TypedConfigGetter.getInt.

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
@Override
getIntback to summary
public Integer getInt(Config config, String section, String subsection, String name, Integer defaultValue)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getInt.

Doc from org.eclipse.jgit.lib.TypedConfigGetter.getInt.

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
@Override
@SuppressWarnings:boxing
getIntInRangeback to summary
public int getIntInRange(Config config, String section, String subsection, String name, int minValue, int maxValue, int defaultValue)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getIntInRange.

Doc from org.eclipse.jgit.lib.TypedConfigGetter.getIntInRange.

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
@Override
getIntInRangeback to summary
public Integer getIntInRange(Config config, String section, String subsection, String name, int minValue, int maxValue, Integer defaultValue)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getIntInRange.

Doc from org.eclipse.jgit.lib.TypedConfigGetter.getIntInRange.

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
@Override
@SuppressWarnings:boxing
getLongback to summary
public long getLong(Config config, String section, String subsection, String name, long defaultValue)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getLong.

Doc from org.eclipse.jgit.lib.TypedConfigGetter.getLong.

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
@Override
getLongback to summary
public Long getLong(Config config, String section, String subsection, String name, Long defaultValue)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getLong.

Doc from org.eclipse.jgit.lib.TypedConfigGetter.getLong.

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
@Override
getRefSpecsback to summary
public List<RefSpec> getRefSpecs(Config config, String section, String subsection, String name)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getRefSpecs.

Doc from org.eclipse.jgit.lib.TypedConfigGetter.getRefSpecs.

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
@Override
@NonNull
getTimeUnitback to summary
public long getTimeUnit(Config config, String section, String subsection, String name, long defaultValue, TimeUnit wantUnit)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getTimeUnit.

Doc from org.eclipse.jgit.lib.TypedConfigGetter.getTimeUnit.

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
@Override
getTimeUnitback to summary
public Long getTimeUnit(Config config, String section, String subsection, String name, Long defaultValue, TimeUnit wantUnit)

Implements org.eclipse.jgit.lib.TypedConfigGetter.getTimeUnit.

Doc from org.eclipse.jgit.lib.TypedConfigGetter.getTimeUnit.

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
@Override
matchback to summary
private static boolean match(String a, String... cases)
neverNullback to summary
private static <T> T neverNull(T one)
Annotations
@NonNull
notTimeUnitback to summary
private static IllegalArgumentException notTimeUnit(String section, String subsection, String name, String valueString)