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

public Class CommandCatalog

extends Object
Class Inheritance
Static Imports
java.nio.charset.StandardCharsets.UTF_8

List of all commands known by jgit's command line tools.

Commands are implementations of org.eclipse.jgit.pgm.TextBuiltin, with an optional org.eclipse.jgit.pgm.Command class annotation to insert additional documentation or override the default command name (which is guessed from the class name).

Commands may be registered by adding them to a services file in the same JAR (or classes directory) as the command implementation. The service file name is META-INF/services/org.eclipse.jgit.pgm.TextBuiltin and it contains one concrete implementation class name per line.

Command registration is identical to Java 6's services, however the catalog uses a lightweight wrapper to delay creating a command instance as much as possible. This avoids initializing the AWT or SWT GUI toolkits even if the command's constructor might require them.

Field Summary

Modifier and TypeField and Description
private final Map<String, CommandRef>
private static final CommandCatalog
private final ClassLoader

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static CommandRef[]

Returns:

all known commands, sorted by command name.
all
()

Get all commands sorted by their name

private Enumeration<URL>
public static CommandRef[]

Returns:

all common commands, sorted by command name.
common
()

Get all common commands sorted by their name

public static CommandRef

Returns:

the command instance; null if no command exists by that name.
get
(String
name of the command. Typically in dash-lower-case-form, which was derived from the DashLowerCaseForm class name.
name
)

Locate a single command by its user friendly name.

private void
private void
scan(URL cUrl)

private static CommandRef[]
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

commandsback to summary
private final Map<String, CommandRef> commands
INSTANCEback to summary
private static final CommandCatalog INSTANCE
ldrback to summary
private final ClassLoader ldr

Constructor Detail

CommandCatalogback to summary
private CommandCatalog()

Method Detail

allback to summary
public static CommandRef[] all()

Get all commands sorted by their name

Returns:CommandRef[]

all known commands, sorted by command name.

catalogsback to summary
private Enumeration<URL> catalogs()
commonback to summary
public static CommandRef[] common()

Get all common commands sorted by their name

Returns:CommandRef[]

all common commands, sorted by command name.

getback to summary
public static CommandRef get(String name)

Locate a single command by its user friendly name.

Parameters
name:String

name of the command. Typically in dash-lower-case-form, which was derived from the DashLowerCaseForm class name.

Returns:CommandRef

the command instance; null if no command exists by that name.

loadback to summary
private void load(String cn)
scanback to summary
private void scan(URL cUrl)
toSortedArrayback to summary
private static CommandRef[] toSortedArray(Collection<CommandRef> c)