1 package com.fasterxml.classmate.members;
2
3 import java.lang.reflect.Method;
4 import java.lang.reflect.Modifier;
5
6 import com.fasterxml.classmate.ResolvedType;
7 import com.fasterxml.classmate.util.MethodKey;
8
9 public final class RawMethod extends RawMember
10 {
11 protected final Method _method;
12
13 protected final int _hashCode;
14
15 public RawMethod(ResolvedType context, Method method)
16 {
17 super(context);
18 _method = method;
19 _hashCode = (_method == null ? 0 : _method.hashCode());
20 }
21
22
27
28 @Override
29 public Method getRawMember() {
30 return _method;
31 }
32
33 public boolean isAbstract() {
34 return Modifier.isAbstract(getModifiers());
35 }
36
37 public boolean isStrict() {
38 return Modifier.isStrict(getModifiers());
39 }
40
41 public boolean isNative() {
42 return Modifier.isNative(getModifiers());
43 }
44
45 public boolean isSynchronized() {
46 return Modifier.isSynchronized(getModifiers());
47 }
48
49 public MethodKey createKey()
50 {
51 String name = _method.getName();
52 Class<?>[] argTypes = _method.getParameterTypes();
53 return new MethodKey(name, argTypes);
54 }
55
56
61
62 @Override public int hashCode()
63 {
64 return _hashCode;
65 }
66
67 @Override public boolean equals(Object o)
68 {
69 if (o == this) return true;
70 if (o == null || o.getClass() != getClass()) return false;
71 RawMethod other = (RawMethod) o;
72 return (other._method == _method);
73 }
74 }
75