1 package com.fasterxml.classmate.members;
2
3 import java.lang.reflect.Constructor;
4
5 import com.fasterxml.classmate.ResolvedType;
6 import com.fasterxml.classmate.util.MethodKey;
7
8 public final class RawConstructor extends RawMember
9 {
10 protected final Constructor<?> _constructor;
11
12 protected final int _hashCode;
13
14 public RawConstructor(ResolvedType context, Constructor<?> constructor)
15 {
16 super(context);
17 _constructor = constructor;
18 _hashCode = (_constructor == null ? 0 : _constructor.hashCode());
19 }
20
21
25 public MethodKey createKey()
26 {
27 String name = "<init>";
28 Class<?>[] argTypes = _constructor.getParameterTypes();
29 return new MethodKey(name, argTypes);
30 }
31
32
37
38 @Override
39 public Constructor<?> getRawMember() {
40 return _constructor;
41 }
42
43
48
49 @Override public int hashCode()
50 {
51 return _hashCode;
52 }
53
54 @Override public boolean equals(Object o)
55 {
56 if (o == this) return true;
57 if (o == null || o.getClass() != getClass()) return false;
58 RawConstructor other = (RawConstructor) o;
59 return (other._constructor == _constructor);
60 }
61 }
62