Skip to content

Commit 65c3579

Browse files
Using getMethod() instead of getDeclaredMethod() to utilise inherited object
1 parent 9798e96 commit 65c3579

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/main/java/utils/docgen/DocumentGenerator.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ public KVGenerator(WorkLoadSettings ws, String keyClass, String valClass) throws
6868
try {
6969
this.keys = keyInstance.getConstructor(WorkLoadSettings.class).newInstance(ws);
7070
this.vals = valInstance.getConstructor(WorkLoadSettings.class).newInstance(ws);
71-
this.keyMethod = this.keyInstance.getDeclaredMethod("next", long.class);
71+
this.keyMethod = this.keyInstance.getMethod("next", long.class);
7272
if (this.valInstance.getSimpleName().equals(SimpleSubDocValue.class.getSimpleName())) {
73-
this.valMethod = this.valInstance.getDeclaredMethod("next", String.class, String.class);
74-
this.subdocLookupMethod = this.valInstance.getDeclaredMethod("next_lookup", String.class);
73+
this.valMethod = this.valInstance.getMethod("next", String.class, String.class);
74+
this.subdocLookupMethod = this.valInstance.getMethod("next_lookup", String.class);
7575
} else {
76-
this.valMethod = this.valInstance.getDeclaredMethod("next", String.class);
76+
this.valMethod = this.valInstance.getMethod("next", String.class);
7777
}
7878
} catch (InstantiationException e) {
7979
e.printStackTrace();
@@ -99,17 +99,17 @@ public KVGenerator(WorkLoadSettings ws, String keyClass, String valClass,
9999
try {
100100
if (this.keyInstance.getSimpleName().equals(CircularKey.class.getSimpleName())) {
101101
this.keys = keyInstance.getConstructor(WorkLoadSettings.class, int.class).newInstance(ws, iterations);
102-
this.iterationsMethod = this.keyInstance.getDeclaredMethod("checkIterations");
102+
this.iterationsMethod = this.keyInstance.getMethod("checkIterations");
103103
}
104104
else
105105
this.keys = keyInstance.getConstructor(WorkLoadSettings.class).newInstance(ws);
106106
this.vals = valInstance.getConstructor(WorkLoadSettings.class).newInstance(ws);
107-
this.keyMethod = this.keyInstance.getDeclaredMethod("next", long.class);
107+
this.keyMethod = this.keyInstance.getMethod("next", long.class);
108108
if (this.valInstance.getSimpleName().equals(SimpleSubDocValue.class.getSimpleName())) {
109-
this.valMethod = this.valInstance.getDeclaredMethod("next", String.class, String.class);
110-
this.subdocLookupMethod = this.valInstance.getDeclaredMethod("next_lookup", String.class);
109+
this.valMethod = this.valInstance.getMethod("next", String.class, String.class);
110+
this.subdocLookupMethod = this.valInstance.getMethod("next_lookup", String.class);
111111
} else {
112-
this.valMethod = this.valInstance.getDeclaredMethod("next", String.class);
112+
this.valMethod = this.valInstance.getMethod("next", String.class);
113113
}
114114
} catch (InstantiationException e) {
115115
e.printStackTrace();
@@ -171,12 +171,12 @@ else if (valClass.equals(RandomlyNestedJson.class.getSimpleName()))
171171
public void set_vbuckets_config(int num_vbuckets, int[] target_vbuckets) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
172172
this.num_vbuckets = num_vbuckets;
173173
this.target_vbuckets = target_vbuckets;
174-
Method set_total_vbs_func = this.keyInstance.getDeclaredMethod("set_total_vbs", int.class);
174+
Method set_total_vbs_func = this.keyInstance.getMethod("set_total_vbs", int.class);
175175
set_total_vbs_func.invoke(this.keys, num_vbuckets);
176176
}
177177

178178
public void generate_keys_for_target_vbs() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
179-
Method genKeysForTargetVBsFunc = this.keyInstance.getDeclaredMethod(
179+
Method genKeysForTargetVBsFunc = this.keyInstance.getMethod(
180180
"generate_keys_for_target_vbs", Long.class, Long.class, int[].class);
181181

182182
if (target_vbuckets != null && target_vbuckets.length > 0) {

0 commit comments

Comments
 (0)