net.m2technologies.open_arm.utilities.collections
Class ExceptionalPredicate

java.lang.Object
  extended bynet.m2technologies.open_arm.utilities.collections.ExceptionalPredicate

public abstract class ExceptionalPredicate
extends java.lang.Object

Copyright 2005 Mark Masterson

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Description: Abstract class to use the Predicate interface to handle checked exceptions. Normally, a selection shouldn't cause any checked exceptions. Every checked exception is wrapped into a RuntimePredicateException. The user of this class has to rewrite the #basicEvaluate method. The usage of this class may be combined with a special #select method to clear the checked exception or unwrap it to throw it again.

Version:
0.009
Author:
Peter Ko�ek

Constructor Summary
ExceptionalPredicate()
           
 
Method Summary
protected abstract  boolean basicEvaluate(java.lang.Object o)
          method to wrap any selecting code who can throw a checked exception.
 boolean evaluate(java.lang.Object o)
          redefine the #evaluate method to establish a mechanism to tunnel checked exceptions through the Commons-Collection API which doesn't know checked exceptions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExceptionalPredicate

public ExceptionalPredicate()
Method Detail

evaluate

public final boolean evaluate(java.lang.Object o)
                       throws RuntimePredicateException
redefine the #evaluate method to establish a mechanism to tunnel checked exceptions through the Commons-Collection API which doesn't know checked exceptions. The method is declared final because you should use #basicEvaluate now.

Throws:
RuntimePredicateException
See Also:
org.apache.commons.collections.Predicate#evaluate

basicEvaluate

protected abstract boolean basicEvaluate(java.lang.Object o)
                                  throws java.lang.Exception
method to wrap any selecting code who can throw a checked exception. This method is called by the #evalutate method of this class, which will wrap the exception into a RuntimePredicateException.

Throws:
java.lang.Exception