01: package net.sourceforge.jaxor.parser;
02:
03: import java.util.StringTokenizer;
04:
05: /*
06: * User: Mike
07: * Date: Jan 5, 2003
08: * Time: 4:09:35 PM
09: */
10:
11: public class MethodModifier {
12:
13: private final String _modifier;
14: private static final String PUBLIC_STRING = "public";
15: public static final MethodModifier PUBLIC = new MethodModifier(
16: PUBLIC_STRING);
17:
18: public MethodModifier(String modifier) {
19: _modifier = modifier;
20: }
21:
22: public String getModifier() {
23: return _modifier;
24: }
25:
26: private boolean isPublic() {
27: return contains(PUBLIC_STRING);
28: }
29:
30: public boolean isInterfaceMethod() {
31: return isPublic() && !contains("final") && !contains("static");
32: }
33:
34: private boolean contains(String value) {
35: StringTokenizer toker = new StringTokenizer(_modifier, " ");
36: while (toker.hasMoreTokens()) {
37: String val = toker.nextToken();
38: if (val.equals(value))
39: return true;
40: }
41: return false;
42: }
43:
44: public String toString() {
45: return _modifier;
46: }
47: }
|