Package com.yahoo.prelude.query.parser
Class SpecialTokenRegistry
- java.lang.Object
-
- com.yahoo.prelude.query.parser.SpecialTokenRegistry
-
public class SpecialTokenRegistry extends java.lang.Object
A registry which is responsible for knowing the current set of special tokens. The default registry returns empty token lists for all names. Usage of this registry is multithread safe.- Author:
- bratseth
-
-
Constructor Summary
Constructors Constructor Description SpecialTokenRegistry()
Creates an empty special token registry which does not subscribe to any configurationSpecialTokenRegistry(com.yahoo.vespa.configdefinition.SpecialtokensConfig config)
Create a special token registry from a configuration object.SpecialTokenRegistry(java.lang.String configId)
Create a special token registry which subscribes to the specialtokens configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSpecialTokens(SpecialTokens specialTokens)
Adds a SpecialTokens instance to the registry.SpecialTokens
getSpecialTokens(java.lang.String name)
Returns the currently authorative list of special tokens for a given name.
-
-
-
Constructor Detail
-
SpecialTokenRegistry
public SpecialTokenRegistry()
Creates an empty special token registry which does not subscribe to any configuration
-
SpecialTokenRegistry
public SpecialTokenRegistry(java.lang.String configId)
Create a special token registry which subscribes to the specialtokens configuration. Only used for testing.
-
SpecialTokenRegistry
public SpecialTokenRegistry(com.yahoo.vespa.configdefinition.SpecialtokensConfig config)
Create a special token registry from a configuration object. This is the production code path.
-
-
Method Detail
-
addSpecialTokens
public void addSpecialTokens(SpecialTokens specialTokens)
Adds a SpecialTokens instance to the registry. That is, add the tokens contained for the name of the SpecialTokens instance given.- Parameters:
specialTokens
- the SpecialTokens object to add
-
getSpecialTokens
public SpecialTokens getSpecialTokens(java.lang.String name)
Returns the currently authorative list of special tokens for a given name.- Parameters:
name
- the name of the special tokens to return null, the empth string or the string "default" returns the default ones- Returns:
- a read-only list of SpecialToken instances, an empty list if this name has no special tokens
-
-