- java.lang.Object
-
- org.eclipse.jgit.attributes.FilterCommandRegistry
-
public class FilterCommandRegistry extends Object
Registry for built-in filters- Since:
- 4.6
-
-
Constructor Summary
Constructors Constructor Description FilterCommandRegistry()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FilterCommandcreateFilterCommand(String filterCommandName, Repository db, InputStream in, OutputStream out)Create a newFilterCommandfor the given name.static Set<String>getRegisteredFilterCommands()Get registered filter commandsstatic booleanisRegistered(String filterCommandName)Check whether anyFilterCommandFactoryis registered for a given command namestatic FilterCommandFactoryregister(String filterCommandName, FilterCommandFactory factory)Register aFilterCommandFactoryresponsible for creatingFilterCommands for a certain command name.static FilterCommandFactoryunregister(String filterCommandName)Unregister theFilterCommandFactoryregistered for the given command name
-
-
-
Method Detail
-
register
public static FilterCommandFactory register(String filterCommandName, FilterCommandFactory factory)
Register aFilterCommandFactoryresponsible for creatingFilterCommands for a certain command name. If the factory f1 is registered for the name "jgit://builtin/x" then a call togetCommand("jgit://builtin/x", ...)will callf1(...)to create a new instance ofFilterCommand- Parameters:
filterCommandName- the command name for which this factory is registeredfactory- the factory responsible for creatingFilterCommands 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 theFilterCommandFactoryregistered 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 anyFilterCommandFactoryis registered for a given command name- Parameters:
filterCommandName- the name for which the registry should be checked- Returns:
trueif any factory was registered for the name
-
getRegisteredFilterCommands
public static Set<String> getRegisteredFilterCommands()
Get registered filter commands- Returns:
- Set of commandNames for which a
FilterCommandFactoryis registered
-
createFilterCommand
public static FilterCommand createFilterCommand(String filterCommandName, Repository db, InputStream in, OutputStream out) throws IOException
Create a newFilterCommandfor the given name. A factory must be registered for the name in advance.- Parameters:
filterCommandName- The name for which a newFilterCommandshould be createddb- the repository this command should work onin- theInputStreamthisFilterCommandshould read fromout- theOutputStreamthisFilterCommandshould write to- Returns:
- the command if a command could be created or
nullif there was no factory registered for that name - Throws:
IOException
-
-