本文整理汇总了Java中org.objectweb.asm.Opcodes.LOOKUPSWITCH属性的典型用法代码示例。如果您正苦于以下问题:Java Opcodes.LOOKUPSWITCH属性的具体用法?Java Opcodes.LOOKUPSWITCH怎么用?Java Opcodes.LOOKUPSWITCH使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.objectweb.asm.Opcodes
的用法示例。
在下文中一共展示了Opcodes.LOOKUPSWITCH属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LookupSwitchInsnNode
/**
* Constructs a new {@link LookupSwitchInsnNode}.
*
* @param dflt
* beginning of the default handler block.
* @param keys
* the values of the keys.
* @param labels
* beginnings of the handler blocks. <tt>labels[i]</tt> is the
* beginning of the handler block for the <tt>keys[i]</tt> key.
*/
public LookupSwitchInsnNode(final LabelNode dflt, final int[] keys,
final LabelNode[] labels) {
super(Opcodes.LOOKUPSWITCH);
this.dflt = dflt;
this.keys = new ArrayList<Integer>(keys == null ? 0 : keys.length);
this.labels = new ArrayList<LabelNode>(labels == null ? 0
: labels.length);
if (keys != null) {
for (int i = 0; i < keys.length; ++i) {
this.keys.add(keys[i]);
}
}
if (labels != null) {
this.labels.addAll(Arrays.asList(labels));
}
}
示例2: visitLookupSwitchInsn
@Override
public final void visitLookupSwitchInsn(final Label dflt, final int[] keys,
final Label[] labels) {
AttributesImpl att = new AttributesImpl();
att.addAttribute("", "dflt", "dflt", "", getLabel(dflt));
String o = Printer.OPCODES[Opcodes.LOOKUPSWITCH];
sa.addStart(o, att);
for (int i = 0; i < labels.length; i++) {
AttributesImpl att2 = new AttributesImpl();
att2.addAttribute("", "name", "name", "", getLabel(labels[i]));
att2.addAttribute("", "key", "key", "", Integer.toString(keys[i]));
sa.addElement("label", att2);
}
sa.addEnd(o);
}
示例3: isSwitch
private static boolean isSwitch(AbstractInsnNode insn) {
return Opcodes.TABLESWITCH == insn.getOpcode() || insn.getOpcode() == Opcodes.LOOKUPSWITCH;
}