olg.csv.bean.filter.impl
Class SplitFilter

Package class diagram package SplitFilter
java.lang.Object
  extended by olg.csv.bean.filter.AbstractStringFilter
      extended by olg.csv.bean.filter.impl.SplitFilter

public final class SplitFilter
extends AbstractStringFilter

Filter which extracts a substring by splitting the given string around matches of an regular expression.


Field Summary
private  int index
          index of the expression to extract.
private  String separator
          the reg exp separator.
 
Constructor Summary
SplitFilter(int index, String separator)
           
 
Method Summary
protected  String doFiltre(String value)
          Realizes the specified transformation promised by this filtre.
 int getIndex()
           
 String getSeparator()
           
 void setIndex(int index)
          Sets the index.
 void setSeparator(String separator)
          Sets the separator.
 
Methods inherited from class olg.csv.bean.filter.AbstractStringFilter
filtre, getDecorateFilter, getFilter, getLowerFilter, getReplaceFilter, getSplitFilter, getTrimFilter, getUpperFilter, getUpperFirstFilter, setFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

separator

private String separator
the reg exp separator.


index

private int index
index of the expression to extract.

Constructor Detail

SplitFilter

public SplitFilter(int index,
                   String separator)
Parameters:
index - the n-th expression found by splitting a string around a separator.
separator - a regular expression. Must not be null
Method Detail

doFiltre

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

Returns the expression found at the index after splitting the value arount the separator. null if the splitted value length is less or equals than the index.

throws UsageInvalideException if separator is null

Specified by:
doFiltre in class AbstractStringFilter
Parameters:
value - the value to filter.
Returns:
the value after filtering.

getSeparator

public String getSeparator()
Returns:
the separator.

setSeparator

public void setSeparator(String separator)
Sets the separator.

Parameters:
separator - the separator. Could be a regexp.

getIndex

public int getIndex()
Returns:
the index.

setIndex

public void setIndex(int index)
Sets the index.

Parameters:
index - the index.


Copyright © 2014. All rights reserved.