当前位置: 首页>>代码示例>>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;未经允许,请勿转载。