Top Description Fields Constructors Methods
org.eclipse.jgit.transport

public Class UrlConfig

extends Object
Class Inheritance
Imports
java.util.HashMap, .Map, .Map.Entry, org.eclipse.jgit.lib.Config

Support for URL translations via git configs url.<base>.insteadOf and url.<base>.pushInsteadOf.
Since
6.2

Field Summary

Modifier and TypeField and Description
private final Config
private Map<String, String>
private static final String
private static final String
private Map<String, String>
private static final String

Constructor Summary

AccessConstructor and Description
public
UrlConfig(Config
Config to read values from
config
)

Creates a new UrlConfig instance.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if there are push replacements, false otherwise
hasPushReplacements
()

Tells whether there are push replacements.

private Map<String, String>
load(String key)

public String

Returns:

the url with substitution applied
replace
(String
to substitute
url
)

Performs replacements as defined by git config url.

private String
replace(String uri, Map<String, String> replacements)

public String

Returns:

the url with substitution applied
replacePush
(String
to substitute
url
)

Performs replacements as defined by git config url.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configback to summary
private final Config config
insteadOfback to summary
private Map<String, String> insteadOf
KEY_INSTEADOFback to summary
private static final String KEY_INSTEADOF
KEY_PUSHINSTEADOFback to summary
private static final String KEY_PUSHINSTEADOF
pushInsteadOfback to summary
private Map<String, String> pushInsteadOf
SECTION_URLback to summary
private static final String SECTION_URL

Constructor Detail

UrlConfigback to summary
public UrlConfig(Config config)

Creates a new UrlConfig instance.

Parameters
config:Config

Config to read values from

Method Detail

hasPushReplacementsback to summary
public boolean hasPushReplacements()

Tells whether there are push replacements.

Returns:boolean

true if there are push replacements, false otherwise

loadback to summary
private Map<String, String> load(String key)
replaceback to summary
public String replace(String url)

Performs replacements as defined by git config url.<base>.insteadOf. If there is no match, the input is returned unchanged.

Parameters
url:String

to substitute

Returns:String

the url with substitution applied

replaceback to summary
private String replace(String uri, Map<String, String> replacements)
replacePushback to summary
public String replacePush(String url)

Performs replacements as defined by git config url.<base>.pushInsteadOf. If there is no match, the input is returned unchanged.

Parameters
url:String

to substitute

Returns:String

the url with substitution applied