Class FilterCommandRegistry

java.lang.Object
org.eclipse.jgit.attributes.FilterCommandRegistry

public class FilterCommandRegistry extends Object
Registry for built-in filters
Since:
4.6
  • Field Details

  • Constructor Details

    • FilterCommandRegistry

      public FilterCommandRegistry()
  • Method Details

    • register

      public static FilterCommandFactory register(String filterCommandName, FilterCommandFactory factory)
      Register a FilterCommandFactory responsible for creating FilterCommands for a certain command name. If the factory f1 is registered for the name "jgit://builtin/x" then a call to getCommand("jgit://builtin/x", ...) will call f1(...) to create a new instance of FilterCommand
      Parameters:
      filterCommandName - the command name for which this factory is registered
      factory - the factory responsible for creating FilterCommands for the specified name
      Returns:
      the previous factory associated with commandName, or null if there was no mapping for commandName
    • unregister

      public static FilterCommandFactory unregister(String filterCommandName)
      Unregister the FilterCommandFactory registered for the given command name
      Parameters:
      filterCommandName - the FilterCommandFactory's filter command name
      Returns:
      the previous factory associated with filterCommandName, or null if there was no mapping for commandName
    • isRegistered

      public static boolean isRegistered(String filterCommandName)
      Check whether any FilterCommandFactory is registered for a given command name
      Parameters:
      filterCommandName - the name for which the registry should be checked
      Returns:
      true if any factory was registered for the name
    • getRegisteredFilterCommands

      public static Set<String> getRegisteredFilterCommands()
      Get registered filter commands
      Returns:
      Set of commandNames for which a FilterCommandFactory is registered
    • createFilterCommand

      public static FilterCommand createFilterCommand(String filterCommandName, Repository db, InputStream in, OutputStream out) throws IOException
      Create a new FilterCommand for the given name. A factory must be registered for the name in advance.
      Parameters:
      filterCommandName - The name for which a new FilterCommand should be created
      db - the repository this command should work on
      in - the InputStream this FilterCommand should read from
      out - the OutputStream this FilterCommand should write to
      Returns:
      the command if a command could be created or null if there was no factory registered for that name
      Throws:
      IOException