net.bytebuddy.implementation.bind.annotation.This.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(187)

本文整理了Java中net.bytebuddy.implementation.bind.annotation.This.<init>()方法的一些代码示例,展示了This.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。This.<init>()方法的具体详情如下:
包路径:net.bytebuddy.implementation.bind.annotation.This
类名称:This
方法名:<init>

This.<init>介绍

暂无

代码示例

代码示例来源:origin: org.mockito/mockito-core

@SuppressWarnings("unused")
  public static int doIdentityHashCode(@This Object thiz) {
    return System.identityHashCode(thiz);
  }
}

代码示例来源:origin: org.mockito/mockito-core

@SuppressWarnings("unused")
  public static boolean doIdentityEquals(@This Object thiz, @Argument(0) Object other) {
    return thiz == other;
  }
}

代码示例来源:origin: redisson/redisson

@RuntimeType
  public static Object intercept(
      @Origin Method method,
      @AllArguments Object[] args,
      @This Object me,
      @FieldValue("liveObjectLiveMap") RMap<?, ?> map
  ) throws Exception {
    if (args.length >= 1 && String.class.isAssignableFrom(args[0].getClass())) {
      String name = ((String) args[0]).substring(0, 1).toUpperCase() + ((String) args[0]).substring(1);
      if ("get".equals(method.getName()) && args.length == 1) {
        try {
          return me.getClass().getMethod("get" + name).invoke(me);
        } catch (NoSuchMethodException noSuchMethodException) {
          throw new NoSuchFieldException((String) args[0]);
        }
      } else if ("set".equals(method.getName()) && args.length == 2) {
        Method m = ClassUtils.searchForMethod(me.getClass(), "set" + name, new Class[]{args[1].getClass()});
        if (m != null) {
          return m.invoke(me, args[1]);
        } else {
          throw new NoSuchFieldException((String) args[0]);
        }
      }
    }
    throw new NoSuchMethodException(method.getName() + " has wrong signature");

  }
}

代码示例来源:origin: redisson/redisson

@RuntimeType
  public static Object intercept(
      @Origin Method method,
      @AllArguments Object[] args,
      @This Object me,
      @FieldValue("liveObjectLiveMap") RMap<?, ?> map
  ) throws Exception {
    if (args.length >= 1 && String.class.isAssignableFrom(args[0].getClass())) {
      String name = ((String) args[0]).substring(0, 1).toUpperCase() + ((String) args[0]).substring(1);
      if ("get".equals(method.getName()) && args.length == 1) {
        try {
          return me.getClass().getMethod("get" + name).invoke(me);
        } catch (NoSuchMethodException noSuchMethodException) {
          throw new NoSuchFieldException((String) args[0]);
        }
      } else if ("set".equals(method.getName()) && args.length == 2) {
        Method m = ClassUtils.searchForMethod(me.getClass(), "set" + name, new Class[]{args[1].getClass()});
        if (m != null) {
          return m.invoke(me, args[1]);
        } else {
          throw new NoSuchFieldException((String) args[0]);
        }
      }
    }
    throw new NoSuchMethodException(method.getName() + " has wrong signature");

  }
}

代码示例来源:origin: org.assertj/assertj-core

@RuntimeType
 public static Object intercept(@This AbstractAssert<?, ?> assertion, @SuperCall Callable<Object> proxy) throws Exception {
  try {
   Object result = proxy.call();
   if (result != assertion && result instanceof AbstractAssert) {
    return asAssumption((AbstractAssert<?, ?>) result).withAssertionState(assertion);
   }
   return result;
  } catch (AssertionError e) {
   throw assumptionNotMet(e);
  }
 }
}

代码示例来源:origin: org.mockito/mockito-core

public static Object doWriteReplace(@This MockAccess thiz) throws ObjectStreamException {
    return thiz.getMockitoInterceptor().getSerializationSupport().writeReplace(thiz);
  }
}

代码示例来源:origin: org.mockito/mockito-core

@SuppressWarnings("unused")
  public static void doReadObject(@Identifier String identifier,
                  @This MockAccess thiz,
                  @Argument(0) ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
    objectInputStream.defaultReadObject();
    MockMethodAdvice mockMethodAdvice = (MockMethodAdvice) MockMethodDispatcher.get(identifier, thiz);
    if (mockMethodAdvice != null) {
      mockMethodAdvice.interceptors.put(thiz, thiz.getMockitoInterceptor());
    }
  }
}

代码示例来源:origin: joel-costigliola/assertj-core

@RuntimeType
 public static Object intercept(@This AbstractAssert<?, ?> assertion, @SuperCall Callable<Object> proxy) throws Exception {
  try {
   Object result = proxy.call();
   if (result != assertion && result instanceof AbstractAssert) {
    return asAssumption((AbstractAssert<?, ?>) result).withAssertionState(assertion);
   }
   return result;
  } catch (AssertionError e) {
   throw assumptionNotMet(e);
  }
 }
}

代码示例来源:origin: hibernate/hibernate-orm

/**
   * Intercepts a method call to a proxy.
   *
   * @param instance The proxied instance.
   * @param method The invoked method.
   * @param arguments The intercepted method arguments.
   *
   * @return The method's return value.
   *
   * @throws Throwable If the intercepted method raises an exception.
   */
  @RuntimeType
  Object intercept(@This Object instance, @Origin Method method, @AllArguments Object[] arguments) throws Throwable;
}

代码示例来源:origin: org.assertj/assertj-core

@RuntimeType
public static AbstractAssert<?, ?> intercept(@FieldValue(FIELD_NAME) ProxifyMethodChangingTheObjectUnderTest dispatcher,
                       @SuperCall Callable<AbstractAssert<?, ?>> assertionMethod,
                       @This AbstractAssert<?, ?> currentAssertInstance) throws Exception {
 Object result = assertionMethod.call();
 return dispatcher.createAssertProxy(result).withAssertionState(currentAssertInstance);
}

代码示例来源:origin: joel-costigliola/assertj-core

@RuntimeType
public static AbstractAssert<?, ?> intercept(@FieldValue(FIELD_NAME) ProxifyMethodChangingTheObjectUnderTest dispatcher,
                       @SuperCall Callable<AbstractAssert<?, ?>> assertionMethod,
                       @This AbstractAssert<?, ?> currentAssertInstance) throws Exception {
 Object result = assertionMethod.call();
 return dispatcher.createAssertProxy(result).withAssertionState(currentAssertInstance);
}

代码示例来源:origin: org.assertj/assertj-core

@This Object assertion,
@SuperCall Callable<?> proxy,
@SuperMethod(nullIfImpossible = true) Method method,

代码示例来源:origin: org.mockito/mockito-core

@SuppressWarnings("unused")
@RuntimeType
@BindingPriority(BindingPriority.DEFAULT * 2)
public static Object interceptSuperCallable(@This Object mock,
                      @FieldValue("mockitoInterceptor") MockMethodInterceptor interceptor,
                      @Origin Method invokedMethod,
                      @AllArguments Object[] arguments,
                      @SuperCall(serializableProxy = true) Callable<?> superCall) throws Throwable {
  if (interceptor == null) {
    return superCall.call();
  }
  return interceptor.doIntercept(
      mock,
      invokedMethod,
      arguments,
      new RealMethod.FromCallable(superCall)
  );
}

代码示例来源:origin: org.mockito/mockito-core

@SuppressWarnings("unused")
  @RuntimeType
  public static Object interceptAbstract(@This Object mock,
                      @FieldValue("mockitoInterceptor") MockMethodInterceptor interceptor,
                      @StubValue Object stubValue,
                      @Origin Method invokedMethod,
                      @AllArguments Object[] arguments) throws Throwable {
    if (interceptor == null) {
      return stubValue;
    }
    return interceptor.doIntercept(
        mock,
        invokedMethod,
        arguments,
        RealMethod.IsIllegal.INSTANCE
    );
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@This final Object instance,
@Origin final Method method,
@AllArguments final Object[] arguments,

代码示例来源:origin: redisson/redisson

@Origin Method method,
@AllArguments Object[] args,
@This Object me,
@FieldValue("liveObjectId") Object id,
@FieldProxy("liveObjectId") Setter idSetter,

代码示例来源:origin: redisson/redisson

@Origin Method method,
@AllArguments Object[] args,
@This Object me,
@FieldValue("liveObjectId") Object id,
@FieldProxy("liveObjectId") Setter idSetter,

代码示例来源:origin: redisson/redisson

@RuntimeType
public Object intercept(@Origin Method method, @SuperCall Callable<?> superMethod,
    @AllArguments Object[] args, @This Object me,
    @FieldValue("liveObjectLiveMap") RMap<String, Object> liveMap) throws Exception {
  if (isGetter(method, getREntityIdFieldName(me))) {

代码示例来源:origin: spockframework/spock

@RuntimeType
public static Object interceptAbstract(@FieldValue("$spock_interceptor") IProxyBasedMockInterceptor proxyBasedMockInterceptor,
                    @This Object self,
                    @AllArguments Object[] arguments,
                    @Origin Method method,
                    @StubValue Object stubValue) throws Exception {
 Object returnValue;
 if (proxyBasedMockInterceptor == null) {
  returnValue = null; // Call before interceptor was set (constructor).
 } else {
  returnValue = proxyBasedMockInterceptor.intercept(self, method, arguments, new ByteBuddyMethodInvoker(null));
 }
 return returnValue == null ? stubValue : returnValue;
}

代码示例来源:origin: spockframework/spock

@RuntimeType
public static Object interceptNonAbstract(@FieldValue("$spock_interceptor") IProxyBasedMockInterceptor proxyBasedMockInterceptor,
                     @Morph ByteBuddyInvoker invoker,
                     @This Object self,
                     @AllArguments Object[] arguments,
                     @Origin Method method,
                     @StubValue Object stubValue) throws Exception {
 Object returnValue;
 if (proxyBasedMockInterceptor == null) {
  returnValue = invoker.call(arguments); // Call before interceptor was set (constructor).
 } else {
  returnValue = proxyBasedMockInterceptor.intercept(self, method, arguments, new ByteBuddyMethodInvoker(invoker));
 }
 return returnValue == null ? stubValue : returnValue;
}

相关文章