當前位置: 首頁>>代碼示例>>Java>>正文


Java Type類代碼示例

本文整理匯總了Java中net.bytebuddy.jar.asm.Type的典型用法代碼示例。如果您正苦於以下問題:Java Type類的具體用法?Java Type怎麽用?Java Type使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Type類屬於net.bytebuddy.jar.asm包,在下文中一共展示了Type類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: describeType

import net.bytebuddy.jar.asm.Type; //導入依賴的package包/類
private Object describeType(Type type) {
  switch (type.getSort()) {
    case Type.OBJECT:
      return type.getInternalName();
    case Type.INT:
    case Type.BYTE:
    case Type.BOOLEAN:
    case Type.SHORT:
      return Opcodes.INTEGER;
    case Type.LONG:
      return Opcodes.LONG;
    case Type.DOUBLE:
      return Opcodes.DOUBLE;
    case Type.FLOAT:
      return Opcodes.FLOAT;
    default:
      throw new IllegalArgumentException("Unhandled type as method argument: " + type);
  }
}
 
開發者ID:apache,項目名稱:beam,代碼行數:20,代碼來源:ByteBuddyDoFnInvokerFactory.java

示例2: visitFrame

import net.bytebuddy.jar.asm.Type; //導入依賴的package包/類
private void visitFrame(
    MethodVisitor mv, boolean localsIncludeReturn, @Nullable String stackTop) {
  boolean hasReturnLocal = (returnVarIndex != null) && localsIncludeReturn;

  Type[] localTypes = Type.getArgumentTypes(instrumentedMethod.getDescriptor());
  Object[] locals = new Object[1 + localTypes.length + (hasReturnLocal ? 1 : 0)];
  locals[0] = instrumentedMethod.getReceiverType().asErasure().getInternalName();
  for (int i = 0; i < localTypes.length; i++) {
    locals[i + 1] = describeType(localTypes[i]);
  }
  if (hasReturnLocal) {
    locals[locals.length - 1] = returnType.getInternalName();
  }

  Object[] stack = stackTop == null ? new Object[] {} : new Object[] {stackTop};

  mv.visitFrame(Opcodes.F_NEW, locals.length, locals, stack.length, stack);
}
 
開發者ID:apache,項目名稱:beam,代碼行數:19,代碼來源:ByteBuddyDoFnInvokerFactory.java

示例3: apply

import net.bytebuddy.jar.asm.Type; //導入依賴的package包/類
@Override
public ByteCodeAppender.Size apply(MethodVisitor mv, Implementation.Context implementationContext, MethodDescription instrumentedMethod) {
	mv.visitVarInsn(ALOAD, 0);
	if (!isStatic) {
		mv.visitFieldInsn(GETFIELD, thisClass, "instance", "Ljava/lang/Object;");
		mv.visitTypeInsn(CHECKCAST, listenerClass);
	}
	mv.visitVarInsn(ALOAD, 1);
	mv.visitTypeInsn(CHECKCAST, eventClass);
	mv.visitMethodInsn(isStatic ? INVOKESTATIC : INVOKEVIRTUAL, listenerClass, callback.getName(), Type.getMethodDescriptor(callback), false);
	mv.visitInsn(RETURN);
	mv.visitMaxs(2, 2);
	return new Size(2, 2);
}
 
開發者ID:Mantaro,項目名稱:MantaroRPG,代碼行數:15,代碼來源:ASMEventHandlerHandle.java


注:本文中的net.bytebuddy.jar.asm.Type類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。