Package org.eclipse.jgit.attributes
Class FilterCommandRegistry
- 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 FilterCommand
createFilterCommand(String filterCommandName, Repository db, InputStream in, OutputStream out)
Create a newFilterCommand
for the given name.static Set<String>
getRegisteredFilterCommands()
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
-
-
-
Method Detail
-
register
public static FilterCommandFactory register(String filterCommandName, FilterCommandFactory factory)
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
public static FilterCommandFactory unregister(String filterCommandName)
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
public static boolean isRegistered(String filterCommandName)
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
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 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
-
-