Class AbstractQueryConfig
- java.lang.Object
-
- org.apache.lucene.util.AttributeSource
-
- org.apache.lucene.queryParser.core.config.AbstractQueryConfig
-
- Direct Known Subclasses:
FieldConfig
,QueryConfigHandler
public abstract class AbstractQueryConfig extends AttributeSource
This class is the base of
QueryConfigHandler
andFieldConfig
. It has operations to set, unset and get configuration values.Each configuration is is a key->value pair. The key should be an unique
NOTE: in future this class will no longer extendConfigurationKey
instance and it also holds the value's type.AttributeSource
- See Also:
ConfigurationKey
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.util.AttributeSource
AttributeSource.AttributeFactory, AttributeSource.State
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <A extends Attribute>
AaddAttribute(Class<A> attClass)
The caller must pass in a Class<? extends Attribute> value.<T> T
get(ConfigurationKey<T> key)
Returns the value held by the given key.<T> T
get(ConfigurationKey<T> key, T defaultValue)
Returns the value held by the given key or the given default value if the key is not found.<T> boolean
has(ConfigurationKey<T> key)
Returns true if there is a value set with the given key, otherwise false.<T> void
set(ConfigurationKey<T> key, T value)
Sets a key and its value.<T> boolean
unset(ConfigurationKey<T> key)
Unsets the given key and its value.-
Methods inherited from class org.apache.lucene.util.AttributeSource
addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, restoreState, toString
-
-
-
-
Method Detail
-
get
public <T> T get(ConfigurationKey<T> key)
Returns the value held by the given key.- Type Parameters:
T
- the value's type- Parameters:
key
- the key, cannot benull
- Returns:
- the value held by the given key
-
get
public <T> T get(ConfigurationKey<T> key, T defaultValue)
Returns the value held by the given key or the given default value if the key is not found.- Type Parameters:
T
- the value's type- Parameters:
key
- the key, cannot benull
defaultValue
- the default value- Returns:
- the value held by the given key or the default value
-
has
public <T> boolean has(ConfigurationKey<T> key)
Returns true if there is a value set with the given key, otherwise false.- Type Parameters:
T
-T
- the value's type- Parameters:
key
- the key, cannot benull
- Returns:
- true if there is a value set with the given key, otherwise false
-
set
public <T> void set(ConfigurationKey<T> key, T value)
Sets a key and its value.- Type Parameters:
T
- the value's type- Parameters:
key
- the key, cannot benull
value
-
-
addAttribute
public <A extends Attribute> A addAttribute(Class<A> attClass)
Description copied from class:AttributeSource
The caller must pass in a Class<? extends Attribute> value. This method first checks if an instance of that class is already in this AttributeSource and returns it. Otherwise a new instance is created, added to this AttributeSource and returned.- Overrides:
addAttribute
in classAttributeSource
-
unset
public <T> boolean unset(ConfigurationKey<T> key)
Unsets the given key and its value.- Type Parameters:
T
- the value's type- Parameters:
key
- the key- Returns:
- true if the key and value was set and removed, otherwise false
-
-