|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.jgit.lib.Config
public class Config
Git style .config, .gitconfig, .gitmodules file.
| Nested Class Summary | |
|---|---|
static interface |
Config.SectionParser<T>
Parses a section of the configuration into an application model object. |
| Constructor Summary | |
|---|---|
Config()
Create a configuration with no default fallback. |
|
Config(Config defaultConfig)
Create an empty configuration with a fallback for missing keys. |
|
| Method Summary | ||
|---|---|---|
protected void |
clear()
Clear the configuration file |
|
void |
fromText(java.lang.String text)
Clear this configuration and reset to the contents of the parsed string. |
|
|
get(Config.SectionParser<T> parser)
Obtain a handle to a parsed set of configuration values. |
|
boolean |
getBoolean(java.lang.String section,
java.lang.String name,
boolean defaultValue)
Get a boolean value from the git config |
|
boolean |
getBoolean(java.lang.String section,
java.lang.String subsection,
java.lang.String name,
boolean defaultValue)
Get a boolean value from the git config |
|
int |
getInt(java.lang.String section,
java.lang.String name,
int defaultValue)
Obtain an integer value from the configuration. |
|
int |
getInt(java.lang.String section,
java.lang.String subsection,
java.lang.String name,
int defaultValue)
Obtain an integer value from the configuration. |
|
long |
getLong(java.lang.String section,
java.lang.String subsection,
java.lang.String name,
long defaultValue)
Obtain an integer value from the configuration. |
|
java.lang.String |
getString(java.lang.String section,
java.lang.String subsection,
java.lang.String name)
Get string value |
|
java.lang.String[] |
getStringList(java.lang.String section,
java.lang.String subsection,
java.lang.String name)
Get a list of string values |
|
java.util.Set<java.lang.String> |
getSubsections(java.lang.String section)
|
|
void |
setBoolean(java.lang.String section,
java.lang.String subsection,
java.lang.String name,
boolean value)
Add or modify a configuration value. |
|
void |
setInt(java.lang.String section,
java.lang.String subsection,
java.lang.String name,
int value)
Add or modify a configuration value. |
|
void |
setLong(java.lang.String section,
java.lang.String subsection,
java.lang.String name,
long value)
Add or modify a configuration value. |
|
void |
setString(java.lang.String section,
java.lang.String subsection,
java.lang.String name,
java.lang.String value)
Add or modify a configuration value. |
|
void |
setStringList(java.lang.String section,
java.lang.String subsection,
java.lang.String name,
java.util.List<java.lang.String> values)
Set a configuration value. |
|
java.lang.String |
toText()
|
|
void |
uncache(Config.SectionParser<?> parser)
Remove a cached configuration object. |
|
void |
unset(java.lang.String section,
java.lang.String subsection,
java.lang.String name)
Remove a configuration value. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Config()
public Config(Config defaultConfig)
defaultConfig - the base configuration to be consulted when a key is missing
from this configuration instance.| Method Detail |
|---|
public int getInt(java.lang.String section,
java.lang.String name,
int defaultValue)
section - section the key is grouped within.name - name of the key to get.defaultValue - default value to return if no value was present.
public int getInt(java.lang.String section,
java.lang.String subsection,
java.lang.String name,
int defaultValue)
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.
public long getLong(java.lang.String section,
java.lang.String subsection,
java.lang.String name,
long defaultValue)
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.
public boolean getBoolean(java.lang.String section,
java.lang.String name,
boolean defaultValue)
section - section the key is grouped within.name - name of the key to get.defaultValue - default value to return if no value was present.
public boolean getBoolean(java.lang.String section,
java.lang.String subsection,
java.lang.String name,
boolean defaultValue)
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.
public java.lang.String getString(java.lang.String section,
java.lang.String subsection,
java.lang.String name)
section - the sectionsubsection - the subsection for the valuename - the key name
public java.lang.String[] getStringList(java.lang.String section,
java.lang.String subsection,
java.lang.String name)
If this instance was created with a base, the base's values are returned first (if any).
section - the sectionsubsection - the subsection for the valuename - the key name
public java.util.Set<java.lang.String> getSubsections(java.lang.String section)
section - section to search for.
public <T> T get(Config.SectionParser<T> parser)
T - type of configuration model to return.parser - parser which can create the model if it is not already
available in this configuration file. The parser is also used
as the key into a cache and must obey the hashCode and equals
contract in order to reuse a parsed model.
public void uncache(Config.SectionParser<?> parser)
If the associated configuration object has not yet been cached, this method has no effect.
parser - parser used to obtain the configuration object.get(SectionParser)
public void setInt(java.lang.String section,
java.lang.String subsection,
java.lang.String name,
int value)
[section "subsection"]
name = value
section - section name, e.g "branch"subsection - optional subsection value, e.g. a branch namename - parameter name, e.g. "filemode"value - parameter value
public void setLong(java.lang.String section,
java.lang.String subsection,
java.lang.String name,
long value)
[section "subsection"]
name = value
section - section name, e.g "branch"subsection - optional subsection value, e.g. a branch namename - parameter name, e.g. "filemode"value - parameter value
public void setBoolean(java.lang.String section,
java.lang.String subsection,
java.lang.String name,
boolean value)
[section "subsection"]
name = value
section - section name, e.g "branch"subsection - optional subsection value, e.g. a branch namename - parameter name, e.g. "filemode"value - parameter value
public void setString(java.lang.String section,
java.lang.String subsection,
java.lang.String name,
java.lang.String value)
[section "subsection"]
name = value
section - section name, e.g "branch"subsection - optional subsection value, e.g. a branch namename - parameter name, e.g. "filemode"value - parameter value, e.g. "true"
public void unset(java.lang.String section,
java.lang.String subsection,
java.lang.String name)
section - section name, e.g "branch"subsection - optional subsection value, e.g. a branch namename - parameter name, e.g. "filemode"
public void setStringList(java.lang.String section,
java.lang.String subsection,
java.lang.String name,
java.util.List<java.lang.String> values)
[section "subsection"]
name = value
section - section name, e.g "branch"subsection - optional subsection value, e.g. a branch namename - parameter name, e.g. "filemode"values - list of zero or more values for this key.public java.lang.String toText()
public void fromText(java.lang.String text)
throws ConfigInvalidException
text - Git style text file listing configuration properties.
ConfigInvalidException - the text supplied is not formatted correctly. No changes were
made to this.protected void clear()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||