net.sf.eos.analyzer
Class TextBuilder

java.lang.Object
  extended by net.sf.eos.config.Configured
      extended by net.sf.eos.analyzer.TextBuilder
All Implemented Interfaces:
Configurable
Direct Known Subclasses:
TextBuilder.SpaceBuilder

public abstract class TextBuilder
extends Configured

Implementation creates new text sequences from Token- or CharSequence-lists. Use newInstance(Configuration) to create a new instance.

Author:
Sascha Kohlmann

Nested Class Summary
static class TextBuilder.SpaceBuilder
          Simple implementation concats all texts from the tokens delimited by space (ASCII 0x20).
 
Field Summary
static TextBuilder SPACE_BUILDER
          Simple implementation concats all texts from the tokens delimited by space (ASCII 0x20).
static String TEXT_BUILDER_IMPL_CONFIG_NAME
          The configuration key name for the classname of the builder.
 
Constructor Summary
TextBuilder()
           
 
Method Summary
abstract  CharSequence buildText(CharSequence... seq)
          Creates a new text from the given CharSequence.
abstract  CharSequence buildText(List<Token> tokens)
          Creates a new text from the given token.
abstract  CharSequence buildText(Token... tokens)
          Creates a new text from the given token.
static TextBuilder newInstance(Configuration config)
          Creates a new instance of a of the builder.
 
Methods inherited from class net.sf.eos.config.Configured
configure, getConfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEXT_BUILDER_IMPL_CONFIG_NAME

@ConfigurationKey(type=CLASSNAME,
                  description="Instances are used to create a new text thru Token concationation.")
public static final String TEXT_BUILDER_IMPL_CONFIG_NAME
The configuration key name for the classname of the builder.

See Also:
newInstance(Configuration), Constant Field Values

SPACE_BUILDER

public static final TextBuilder SPACE_BUILDER
Simple implementation concats all texts from the tokens delimited by space (ASCII 0x20).

Constructor Detail

TextBuilder

public TextBuilder()
Method Detail

newInstance

@FactoryMethod(key="net.sf.eos.analyzer.TextBuilder.impl",
               implementation=TextBuilder.SpaceBuilder.class)
public static final TextBuilder newInstance(Configuration config)
                                     throws EosException
Creates a new instance of a of the builder. If the Configuration contains a key TEXT_BUILDER_IMPL_CONFIG_NAME a new instance of the classname of the value will instantiate. The SPACE_BUILDER 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

buildText

public abstract CharSequence buildText(List<Token> tokens)
Creates a new text from the given token.

Parameters:
tokens - a list of token. If tokens is null an exception will raise.
Returns:
a new text, never null

buildText

public abstract CharSequence buildText(Token... tokens)
Creates a new text from the given token.

Parameters:
tokens - a list of token If tokens is null an exception will raise.
Returns:
a new text, never null

buildText

public abstract CharSequence buildText(CharSequence... seq)
Creates a new text from the given CharSequence.

Parameters:
seq - a list of CharSequence If tokens is null an exception will raise.
Returns:
a new text, never null


Copyright © 2008. All Rights Reserved.