Package org.eclipse.jgit.attributes
Class FilterCommandRegistry
- java.lang.Object
-
- org.eclipse.jgit.attributes.FilterCommandRegistry
-
public class FilterCommandRegistry extends java.lang.ObjectRegistry for built-in filters- Since:
- 4.6
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<java.lang.String,FilterCommandFactory>filterCommandRegistry
-
Constructor Summary
Constructors Constructor Description FilterCommandRegistry()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FilterCommandcreateFilterCommand(java.lang.String filterCommandName, Repository db, java.io.InputStream in, java.io.OutputStream out)Create a newFilterCommandfor the given name.static java.util.Set<java.lang.String>getRegisteredFilterCommands()Get registered filter commandsstatic booleanisRegistered(java.lang.String filterCommandName)Check whether anyFilterCommandFactoryis registered for a given command namestatic FilterCommandFactoryregister(java.lang.String filterCommandName, FilterCommandFactory factory)Register aFilterCommandFactoryresponsible for creatingFilterCommands for a certain command name.static FilterCommandFactoryunregister(java.lang.String filterCommandName)Unregister theFilterCommandFactoryregistered for the given command name
-
-
-
Field Detail
-
filterCommandRegistry
private static java.util.Map<java.lang.String,FilterCommandFactory> filterCommandRegistry
-
-
Method Detail
-
register
public static FilterCommandFactory register(java.lang.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(java.lang.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(java.lang.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 java.util.Set<java.lang.String> getRegisteredFilterCommands()
Get registered filter commands- Returns:
- Set of commandNames for which a
FilterCommandFactoryis registered
-
createFilterCommand
public static FilterCommand createFilterCommand(java.lang.String filterCommandName, Repository db, java.io.InputStream in, java.io.OutputStream out) throws java.io.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:
java.io.IOException
-
-