|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jgit.api.GitCommand<T>
T
- the return type which is expected from call()
public abstract class GitCommand<T>
Common superclass of all commands in the package org.eclipse.jgit.api
This class ensures that all commands fulfill the Callable
interface.
It also has a property repo
holding a reference to the git
Repository
this command should work with.
Finally this class stores a state telling whether it is allowed to call
call()
on this instance. Instances of GitCommand
can only be
used for one single successful call to call()
. Afterwards this
instance may not be used anymore to set/modify any properties or to call
call()
again. This is achieved by setting the callable
property to false after the successful execution of call()
and to
check the state (by calling checkCallable()
) before setting of
properties and inside call()
.
Field Summary | |
---|---|
protected Repository |
repo
The repository this command is working with |
Constructor Summary | |
---|---|
protected |
GitCommand(Repository repo)
Creates a new command which interacts with a single repository |
Method Summary | |
---|---|
abstract T |
call()
Executes the command |
protected void |
checkCallable()
Checks that the property callable is true . |
Repository |
getRepository()
|
protected void |
setCallable(boolean callable)
Set's the state which tells whether it is allowed to call call()
on this instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Repository repo
Constructor Detail |
---|
protected GitCommand(Repository repo)
repo
- the Repository
this command should interact withMethod Detail |
---|
public Repository getRepository()
Repository
this command is interacting withprotected void setCallable(boolean callable)
call()
on this instance. checkCallable()
will throw an exception when
called and this property is set to false
callable
- if true
it is allowed to call call()
on
this instance.protected void checkCallable()
callable
is true
. If not then
an IllegalStateException
is thrown
IllegalStateException
- when this method is called and the property callable
is false
public abstract T call() throws GitAPIException
call
in interface Callable<T>
GitAPIException
- or subclass thereof when an error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |