proper.util
Class Excluder

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

public class Excluder
extends java.lang.Object
implements CluderInterface

This class is used to check a field name against a "black list" field names. It can also contain wildcards like "bla*", "*bla" or "*bla*". This can be done case-sensitive or -insensitive.

Version:
$Revision: 1.2 $
Author:
FracPete
See Also:
Includer

Constructor Summary
Excluder(java.lang.String l)
          initializes the object with a comma separated list of field names (case-insensitive!)
Excluder(java.lang.String l, boolean casesensitive)
          initializes the object with a comma separated list of field names (case-sensitive!)
Excluder(java.lang.String l, boolean casesensitive, boolean regexp)
          initializes the object with a comma separated list of field names (case-sensitive!)
Excluder(java.util.Vector l)
          initializes the object with a given list of names (case-insensitive!)
Excluder(java.util.Vector l, boolean casesensitive)
          initializes the object with a given list of names
Excluder(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 black list
 boolean getRegExp()
          returns the regular expression state
static void main(java.lang.String[] args)
          for testing only
 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, i.e.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Excluder

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

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

Excluder

public Excluder(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

Excluder

public Excluder(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

Excluder

public Excluder(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

Excluder

public Excluder(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

Excluder

public Excluder(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 black 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, i.e. the black list

Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)
for testing only