I know to create an object dynamically of any class, I can do
Class<?> c = Class.forName("fully equalified name");
Object o = c.getDeclaredConstructor(TypeParams).newInstance();
But say now I need to create a Consumer and pass it to a method. It is not enough to just pass in the raw type Consumer because that method (given to me) internally needs to figure out A using reflection.
Is there a way to do so in Java?
答案 0 :(得分:2)
erased nature of generics使您想做的事情变得不可能。
答案 1 :(得分:0)
没有办法找出A&#34;来自SELECT *
FROM aset
WHERE ttime >= (SELECT MAX (ttime)
FROM aset)
- INTERVAL '5' MINUTE;
一般。此外,您不能做任何不同于创建原始消费者的事情。
您几乎肯定需要明确传递 with bset
AS
(SELECT ttime, cnt, MAX (ttime) OVER () - ttime AS delta
FROM aset)
SELECT *
FROM bset
WHERE delta <= INTERVAL '5' MINUTE
个对象。