本文整理匯總了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;
}