Package org.eclipse.jgit.attributes
Class FilterCommandRegistry
java.lang.Object
org.eclipse.jgit.attributes.FilterCommandRegistry
Registry for built-in filters
- Since:
- 4.6
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FilterCommand
createFilterCommand
(String filterCommandName, Repository db, InputStream in, OutputStream out) Create a newFilterCommand
for the given name.Get registered filter commandsstatic boolean
isRegistered
(String filterCommandName) Check whether anyFilterCommandFactory
is registered for a given command namestatic FilterCommandFactory
register
(String filterCommandName, FilterCommandFactory factory) Register aFilterCommandFactory
responsible for creatingFilterCommand
s for a certain command name.static FilterCommandFactory
unregister
(String filterCommandName) Unregister theFilterCommandFactory
registered for the given command name
-
Field Details
-
filterCommandRegistry
-
-
Constructor Details
-
FilterCommandRegistry
public FilterCommandRegistry()
-
-
Method Details
-
register
Register aFilterCommandFactory
responsible for creatingFilterCommand
s 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 creatingFilterCommand
s for the specified name- Returns:
- the previous factory associated with commandName, or null if there was no mapping for commandName
-
unregister
Unregister theFilterCommandFactory
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
Check whether anyFilterCommandFactory
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
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 newFilterCommand
for the given name. A factory must be registered for the name in advance.- Parameters:
filterCommandName
- The name for which a newFilterCommand
should be createddb
- the repository this command should work onin
- theInputStream
thisFilterCommand
should read fromout
- theOutputStream
thisFilterCommand
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
-