KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > collections > functors > ExceptionPredicate


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.collections.functors;
17
18 import java.io.Serializable JavaDoc;
19
20 import org.apache.commons.collections.FunctorException;
21 import org.apache.commons.collections.Predicate;
22
23 /**
24  * Predicate implementation that always throws an exception.
25  *
26  * @since Commons Collections 3.0
27  * @version $Revision: 1.7 $ $Date: 2004/05/16 11:16:01 $
28  *
29  * @author Stephen Colebourne
30  */

31 public final class ExceptionPredicate implements Predicate, Serializable JavaDoc {
32
33     /** Serial version UID */
34     static final long serialVersionUID = 7179106032121985545L;
35     
36     /** Singleton predicate instance */
37     public static final Predicate INSTANCE = new ExceptionPredicate();
38
39     /**
40      * Factory returning the singleton instance.
41      *
42      * @return the singleton instance
43      * @since Commons Collections 3.1
44      */

45     public static Predicate getInstance() {
46         return INSTANCE;
47     }
48
49     /**
50      * Restricted constructor.
51      */

52     private ExceptionPredicate() {
53         super();
54     }
55
56     /**
57      * Evaluates the predicate always throwing an exception.
58      *
59      * @param object the input object
60      * @return never
61      * @throws FunctorException always
62      */

63     public boolean evaluate(Object JavaDoc object) {
64         throw new FunctorException("ExceptionPredicate invoked");
65     }
66     
67 }
68
Popular Tags