KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > routing > filters > logic > OrFilter


1 /*
2  * $Id: OrFilter.java 4219 2006-12-09 10:15:14Z lajos $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.routing.filters.logic;
12
13 import org.mule.umo.UMOFilter;
14 import org.mule.umo.UMOMessage;
15
16 /**
17  * <code>OrFilter</code> accepts if the leftFilter or rightFilter filter accept.
18  */

19
20 public class OrFilter implements UMOFilter
21 {
22     private UMOFilter leftFilter;
23     private UMOFilter rightFilter;
24
25     public OrFilter(UMOFilter leftFilter, UMOFilter rightFilder)
26     {
27         this.leftFilter = leftFilter;
28         this.rightFilter = rightFilder;
29     }
30
31     public OrFilter()
32     {
33         super();
34     }
35
36     public void setLeftFilter(UMOFilter leftFilter)
37     {
38         this.leftFilter = leftFilter;
39     }
40
41     public void setRightFilter(UMOFilter rightFilter)
42     {
43         this.rightFilter = rightFilter;
44     }
45
46     public UMOFilter getLeftFilter()
47     {
48         return leftFilter;
49     }
50
51     public UMOFilter getRightFilter()
52     {
53         return rightFilter;
54     }
55
56     public boolean accept(UMOMessage message)
57     {
58         return ((leftFilter != null && leftFilter.accept(message)) || (rightFilter != null && rightFilter
59             .accept(message)));
60     }
61
62 }
63
Popular Tags