net.sf.eos.lucene
Class AnalyzerSupplier

java.lang.Object
  extended by net.sf.eos.lucene.AnalyzerSupplier
All Implemented Interfaces:
Supplier<org.apache.lucene.analysis.Analyzer>
Direct Known Subclasses:
WhitespaceAnalyzerSupplier

public abstract class AnalyzerSupplier
extends Object
implements Supplier<org.apache.lucene.analysis.Analyzer>

To support different strategies of Lucene analyzers this factory decoupled the creation of the analyzer from hard coded classnames. Set the classname of a factory different from default implementation. ANALYZER_PROVIDER_IMPL_CONFIG_NAME contains the name of the configuration key.

Implementations must have a default constructor and must implement get().

Author:
Sascha Kohlmann

Field Summary
static String ANALYZER_PROVIDER_IMPL_CONFIG_NAME
          The configuration key name for the classname of the factory.
 
Constructor Summary
AnalyzerSupplier()
           
 
Method Summary
abstract  org.apache.lucene.analysis.Analyzer get()
          Returns a new Analyzer instance.
static AnalyzerSupplier newInstance(Configuration config)
          Creates a new instance of a of the provider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANALYZER_PROVIDER_IMPL_CONFIG_NAME

@ConfigurationKey(type=CLASSNAME,
                  description="Configuration key of the Lucene analyzer  factory.")
public static final String ANALYZER_PROVIDER_IMPL_CONFIG_NAME
The configuration key name for the classname of the factory.

See Also:
newInstance(Configuration), Constant Field Values
Constructor Detail

AnalyzerSupplier

public AnalyzerSupplier()
Method Detail

newInstance

@FactoryMethod(key="net.sf.eos.lucene.AnalyzerProvider.impl")
public static final AnalyzerSupplier newInstance(Configuration config)
                                          throws EosException
Creates a new instance of a of the provider. If the Configuration contains a key ANALYZER_PROVIDER_IMPL_CONFIG_NAME a new instance of the classname in the value will instantiate. The WhitespaceAnalyzerSupplier will instantiate if there is no value setted.

Parameters:
config - the configuration
Returns:
a new instance
Throws:
EosException - if it is not possible to instantiate an instance

get

public abstract org.apache.lucene.analysis.Analyzer get()
Returns a new Analyzer instance.

Specified by:
get in interface Supplier<org.apache.lucene.analysis.Analyzer>
Returns:
a new Analyzer instance


Copyright © 2008. All Rights Reserved.