KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > spoon > support > query > ReturnOrThrowFilter


1 package spoon.support.query;
2
3 import spoon.reflect.code.CtCFlowBreak;
4 import spoon.reflect.code.CtReturn;
5 import spoon.reflect.code.CtThrow;
6
7 /**
8  * This simple filter matches all the occurences of a return or a throw
9  * statement (end of execution flow).
10  */

11 public class ReturnOrThrowFilter extends AbstractFilter<CtCFlowBreak> {
12
13     /**
14      * Creates a filter.
15      */

16     public ReturnOrThrowFilter() {
17         super(CtCFlowBreak.class);
18     }
19
20     public boolean matches(CtCFlowBreak cflowBreak) {
21         return (cflowBreak instanceof CtReturn)
22                 || (cflowBreak instanceof CtThrow);
23     }
24 }
Popular Tags