I am trying to pass two generics with known types (accumulationFunction, resultBindings) into the reflective invoke routine below, but I'm having trouble. Can someone help me understand how this can be achieved?
package com.amir.method.compiler;
//hidden imports
import java.util.Set;
public class CompiledReferencedAttributeMethod implements CompiledMethod {
final Class<?> generatedClazz;
//how do i pass the arguments below into the invoke routine??
final KnownWorkData<AccumulationFunction> accumulationFunction;
final KnownWorkData<Set<Executable<InstanceSetValue>>> resultBindings;
public CompiledReferencedAttributeMethod(final int hash,
final KnownWorkData<AccumulationFunction> accumulationFunction,
final KnownWorkData<Set<Executable<InstanceSetValue>>> resultBindings) {
this.generatedClazz = ReferencedAttributeMethodGenerator.get().compileMethod(
"com.amir.hotspot.GeneratedGRAMethod" +hash, "dynamicGra", accumulationFunction, resultBindings);
this.accumulationFunction = accumulationFunction;
this.resultBindings = resultBindings;
}
@Override
public WorkDataValue invokeCompiled(final Instance onInst,
final ExecutionParms parm,
final WorkDataDefinition returntype,
final TaskContext context) {
try {
return (WorkDataValue) this.generatedClazz
.getMethod("dynamicGra",
Instance.class,
ExecutionParms.class,
WorkDataDefinition.class,
TaskContext.class)
.invoke(null, onInst, parm, returntype, this.accumulationFunction, this.resultBindings, context);
} catch(Exception e) {
throw new ExecuteCompiledMethodException(this.toString(), e);
}
}
}