I have an object of type java.lang.reflect.Method
and i need to set it to the fallowing variable BiConsumer<_notaFiscalServicoGeraServicosMov, Double> metodoSetBC
.
Is it possible to obtain the reference from the java.lang.reflect.Method
instance?
BiConsumer<_notaFiscalServicoGeraServicosMov, Double> consumer = (instance, param) -> {
try {
methodInstance.invoke(instance, new Object[] {param});
} catch (LotsOfExceptionsHere e) {
throw new RuntimeException(e);
}
};
that should do it. There's no other way, really.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.