Class GitCommand<T>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Repository repo
      The repository this command is working with
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected GitCommand​(Repository repo)
      Creates a new command which interacts with a single repository
    • Field Detail

      • repo

        protected final Repository repo
        The repository this command is working with
    • Constructor Detail

      • GitCommand

        protected GitCommand​(Repository repo)
        Creates a new command which interacts with a single repository
        Parameters:
        repo - the Repository this command should interact with
    • Method Detail

      • getRepository

        public Repository getRepository()
        Returns:
        the Repository this command is interacting with
      • setCallable

        protected void setCallable​(boolean callable)
        Set's the state which tells whether it is allowed to call call() on this instance. checkCallable() will throw an exception when called and this property is set to false
        Parameters:
        callable - if true it is allowed to call call() on this instance.
      • checkCallable

        protected void checkCallable()
        Checks that the property callable is true. If not then an IllegalStateException is thrown
        Throws:
        java.lang.IllegalStateException - when this method is called and the property callable is false
      • call

        public abstract T call()
                        throws GitAPIException
        Executes the command
        Specified by:
        call in interface java.util.concurrent.Callable<T>
        Returns:
        T a result. Each command has its own return type
        Throws:
        GitAPIException - or subclass thereof when an error occurs