proper.util
Class Includer

java.lang.Object
  extended by proper.util.Includer
All Implemented Interfaces:
CluderInterface

public class Includer
extends java.lang.Object
implements CluderInterface

This class is used to check a field name against a "white list" field names. It can also contain wildcards like "bla*", "*bla" or "*bla*". This can be done case-sensitive or -insensitive.
But instead of using only this simple matching scheme you can also use Perl 5 regular expressions. For this it uses the matches method of the String class.
It is basically an Excluder with a wrapper around, s.t. java can distinguish between the Includer and Excluder class (handy for polymorphism).

Version:
$Revision: 1.2 $
Author:
FracPete
See Also:
Excluder, String.matches(String)

Constructor Summary
Includer(java.lang.String l)
          initializes the object with a comma separated list of field names (case-insensitive!)
Includer(java.lang.String l, boolean casesensitive)
          initializes the object with a comma separated list of field names (case-sensitive!)
Includer(java.lang.String l, boolean casesensitive, boolean regexp)
          initializes the object with a comma separated list of field names (case-sensitive!)
Includer(java.util.Vector l)
          initializes the object with a given list of names (case-insensitive!)
Includer(java.util.Vector l, boolean casesensitive)
          initializes the object with a given list of names
Includer(java.util.Vector l, boolean casesensitive, boolean regexp)
          initializes the object with a given list of names
 
Method Summary
 boolean contains(java.lang.String s)
          checks whether the given String is in the list included
 boolean contains(java.lang.String s, boolean regexp)
          checks whether the given String is in the list included if regexp is TRUE the given String is assumed to be a regular Expression and that the list contains only normal strings
 boolean getCaseSensitive()
          returns the case-sensitive state
 java.util.Vector getList()
          returns the white list
 boolean getRegExp()
          returns the regular expression state
 int matchIndex(java.lang.String s)
          returns the index in the list where the first match was encountered
 int matchIndex(java.lang.String s, boolean regexp)
          returns the index in the list where the first match was encountered; if regexp is TRUE the given String is assumed to be a regular Expression and that the list contains only normal strings
 java.lang.String toString()
          returns a string representation of the list
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Includer

public Includer(java.util.Vector l)
initializes the object with a given list of names (case-insensitive!)

Parameters:
l - contains field names (wildcard * is allowed)

Includer

public Includer(java.util.Vector l,
                boolean casesensitive)
initializes the object with a given list of names

Parameters:
l - contains field names (wildcard * is allowed)
casesensitive - whether to be case-sensitive or not

Includer

public Includer(java.util.Vector l,
                boolean casesensitive,
                boolean regexp)
initializes the object with a given list of names

Parameters:
l - contains field names (wildcard * is allowed)
casesensitive - whether to be case-sensitive or not
regexp - whether to use perl 5 regexp instead of the simple "*"-matching

Includer

public Includer(java.lang.String l)
initializes the object with a comma separated list of field names (case-insensitive!)

Parameters:
l - a string containing field names, separated by comma

Includer

public Includer(java.lang.String l,
                boolean casesensitive)
initializes the object with a comma separated list of field names (case-sensitive!)

Parameters:
l - a string containing field names, separated by comma
casesensitive - whether to be case-sensitive or not

Includer

public Includer(java.lang.String l,
                boolean casesensitive,
                boolean regexp)
initializes the object with a comma separated list of field names (case-sensitive!)

Parameters:
l - a string containing field names, separated by comma
casesensitive - whether to be case-sensitive or not
regexp - whether to use perl 5 regexp instead of the simple "*"-matching
Method Detail

getList

public java.util.Vector getList()
returns the white list

Specified by:
getList in interface CluderInterface

getCaseSensitive

public boolean getCaseSensitive()
returns the case-sensitive state

Specified by:
getCaseSensitive in interface CluderInterface

getRegExp

public boolean getRegExp()
returns the regular expression state


matchIndex

public int matchIndex(java.lang.String s)
returns the index in the list where the first match was encountered

Specified by:
matchIndex in interface CluderInterface

matchIndex

public int matchIndex(java.lang.String s,
                      boolean regexp)
returns the index in the list where the first match was encountered; if regexp is TRUE the given String is assumed to be a regular Expression and that the list contains only normal strings

Specified by:
matchIndex in interface CluderInterface
Parameters:
regexp - whether the given string is a regular expression or not

contains

public boolean contains(java.lang.String s)
checks whether the given String is in the list included

Specified by:
contains in interface CluderInterface

contains

public boolean contains(java.lang.String s,
                        boolean regexp)
checks whether the given String is in the list included if regexp is TRUE the given String is assumed to be a regular Expression and that the list contains only normal strings

Specified by:
contains in interface CluderInterface
Parameters:
regexp - whether the given string is a regular expression or not

toString

public java.lang.String toString()
returns a string representation of the list

Overrides:
toString in class java.lang.Object