olg.csv.bean.filter
Class AbstractStringFilter

Package class diagram package AbstractStringFilter
java.lang.Object
  extended by olg.csv.bean.filter.AbstractStringFilter
Direct Known Subclasses:
DecorateFilter, LowerCaseFilter, ReplaceFilter, SplitFilter, TrimFilter, UpperCaseFilter, UpperCaseFirstFilter

public abstract class AbstractStringFilter
extends Object

Abstract class specialized in converting a string into another.


Field Summary
private  AbstractStringFilter filter
          The successor in the filter chain.
 
Constructor Summary
AbstractStringFilter()
           
 
Method Summary
protected abstract  String doFiltre(String value)
          Realizes the specified transformation promised by this filtre.
 String filtre(String value)
          Returns the transformed string passed through this filter and his successors.
static AbstractStringFilter getDecorateFilter(String before, String after)
          Returns a filter which decorate the given string.
 AbstractStringFilter getFilter()
          Returns the successor.
static AbstractStringFilter getLowerFilter(Locale locale)
          Returns a filter specialized in lowercase setting.
static AbstractStringFilter getReplaceFilter(String regex, String replacement)
          Returns a filter which replace all the occurrences of an regular expression in a string by a particular value.
static AbstractStringFilter getSplitFilter(int index, String separator)
          Returns a filter which extracts a substring by splitting the given string around matches of an regular expression.
static AbstractStringFilter getTrimFilter()
          Returns a Filter which execute String String.trim() method.
static AbstractStringFilter getUpperFilter(Locale locale)
          Returns a filter specialized in uppercase setting.
static AbstractStringFilter getUpperFirstFilter(Locale locale)
          Returns a filter specialized in uppercase setting of the first letter of a string.
 void setFilter(AbstractStringFilter filter)
          Sets the successor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filter

private AbstractStringFilter filter
The successor in the filter chain.

Constructor Detail

AbstractStringFilter

public AbstractStringFilter()
Method Detail

doFiltre

protected abstract String doFiltre(String value)
Realizes the specified transformation promised by this filtre.

Parameters:
value - the value to filter.
Returns:
the value after filtering.

filtre

public final String filtre(String value)
Returns the transformed string passed through this filter and his successors.

Parameters:
value - the string to filter
Returns:
the value after successing filtering.

getFilter

public AbstractStringFilter getFilter()
Returns the successor.

Returns:
the successor.

setFilter

public void setFilter(AbstractStringFilter filter)
Sets the successor.

Parameters:
filter - the successor in the filters chain.

getLowerFilter

public static final AbstractStringFilter getLowerFilter(Locale locale)
Returns a filter specialized in lowercase setting.

Parameters:
locale - the locale to use. if null default locale is used.
Returns:
a new instance

getUpperFilter

public static final AbstractStringFilter getUpperFilter(Locale locale)
Returns a filter specialized in uppercase setting.

Parameters:
locale - the locale. If null jvm default locale is used.
Returns:
a new instance

getUpperFirstFilter

public static final AbstractStringFilter getUpperFirstFilter(Locale locale)
Returns a filter specialized in uppercase setting of the first letter of a string.

Parameters:
locale - the locale. If null jvm default locale is used.
Returns:
a new instance

getDecorateFilter

public static final AbstractStringFilter getDecorateFilter(String before,
                                                           String after)
Returns a filter which decorate the given string.

Parameters:
before - this string will be added front of the given string. Can be null
after - this string will be added behind the given string. Can be null
Returns:
a new instance

getTrimFilter

public static final AbstractStringFilter getTrimFilter()
Returns a Filter which execute String String.trim() method.

Returns:
a new instance

getSplitFilter

public static final AbstractStringFilter getSplitFilter(int index,
                                                        String separator)
Returns a filter which extracts a substring by splitting the given string around matches of an regular expression.

throws an IllegalArgumentException if separator argument is null

Parameters:
index - the n-th value
separator - a regular expression. Must be not null
Returns:
a new instance

getReplaceFilter

public static final AbstractStringFilter getReplaceFilter(String regex,
                                                          String replacement)
Returns a filter which replace all the occurrences of an regular expression in a string by a particular value.

throws an IllegalArgumentException if regex or replacement argument is null

Parameters:
regex - the regular expression
replacement - the replacement value
Returns:
a new instance


Copyright © 2014. All rights reserved.