Hello,
I'm trying to implement the switch/case below in java but can't seem to find an efficient way to avoid the "case expressions must be constant expressions" error.? I can create a new class and access the bidPrice/askPrice constants successfully that way, but I'm guessing that's overkill.? Appreciate any guidance on this programming question.?
Thank you.
public class MyWrapper implements EWrapper?
{
public static final int bidPrice = TickType.BID.index();
public static final int askPrice = TickType.ASK.index();
?
public void tickPrice(int tickerId, int field, double price, TickAttrib attrib)
{
switch (field)?
{? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? case bidPrice:
?
? ? ? ? ? ? ? ? break;
? ? ? ? ? ??
? ? ? ? ? ? ? ? case askPrice:
? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
}
}
}