1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.org.usurper.model;
20
21 import java.lang.reflect.Constructor;
22
23 import org.org.usurper.setup.IUsurperGeneratorSetup;
24
25
26
27
28 public class HandledConstructorArg implements IHandledEntity {
29
30 private final Constructor<?> targetConstructor;
31
32 private final Class<?> constructorArgClass;
33
34 private final Integer constructorArgOrderingNumber;
35
36 private final IUsurperGeneratorSetup usurperGeneratorSetup;
37
38
39
40
41
42
43
44
45
46
47
48 public HandledConstructorArg(final Constructor<?> targetConstructor, final Class<?> constructorArgClass, final Integer constructorArgOrderingNumber, final IUsurperGeneratorSetup usurperGeneratorSetup) {
49 super();
50 this.targetConstructor = targetConstructor;
51 this.constructorArgClass = constructorArgClass;
52 this.constructorArgOrderingNumber = constructorArgOrderingNumber;
53 this.usurperGeneratorSetup = usurperGeneratorSetup;
54 }
55
56
57
58
59
60
61 public Constructor<?> getTargetConstructor() {
62 return targetConstructor;
63 }
64
65
66
67
68
69
70 public Class<?> getConstructorArgClass() {
71 return constructorArgClass;
72 }
73
74
75
76
77
78
79 public Integer getConstructorArgOrderingNumber() {
80 return constructorArgOrderingNumber;
81 }
82
83
84
85
86
87
88 public IUsurperGeneratorSetup getUsurperGeneratorSetup() {
89 return usurperGeneratorSetup;
90 }
91
92 @Override
93 public String toString() {
94 StringBuilder stringBuilder = new StringBuilder();
95 stringBuilder.append("Target constructor: " + targetConstructor.toGenericString());
96 stringBuilder.append("constructor arg: " + constructorArgClass.getName() + " (" + constructorArgOrderingNumber + ")");
97 return stringBuilder.toString();
98 }
99
100 @Override
101 public boolean equals(Object obj) {
102 if (this == obj)
103 return true;
104 if ((obj == null) || (obj.getClass() != this.getClass()))
105 return false;
106
107 HandledConstructorArg other = (HandledConstructorArg) obj;
108 return targetConstructor.equals(other.targetConstructor) && constructorArgClass.getName().equals(other.constructorArgClass.getName()) && constructorArgOrderingNumber == other.constructorArgOrderingNumber;
109 }
110
111 @Override
112 public int hashCode() {
113 int hash = 7;
114 hash = 31 * hash + (null == targetConstructor ? 0 : targetConstructor.hashCode());
115 hash = 31 * hash + (null == constructorArgClass ? 0 : constructorArgClass.hashCode());
116 hash = 31 * hash + (null == constructorArgOrderingNumber ? 0 : constructorArgOrderingNumber.hashCode());
117 return hash;
118 }
119 }