/** * Creates a new method delegation binder that binds method based on annotations found on the target method. * * @param parameterBinders A list of parameter binder delegates. Each such delegate is responsible for creating a * {@link net.bytebuddy.implementation.bind.MethodDelegationBinder.ParameterBinding} * for a specific annotation. * @return An appropriate method delegation binder. */ public static MethodDelegationBinder of(List<? extends ParameterBinder<?>> parameterBinders) { return new TargetMethodAnnotationDrivenBinder(DelegationProcessor.of(parameterBinders)); }
/** * Creates a new binder for a {@link FieldProxy} in simplex mode. * * @param getterMethod The getter method. * @param setterMethod The setter method. */ protected Binder(MethodDescription.InDefinedShape getterMethod, MethodDescription.InDefinedShape setterMethod) { this(new FieldResolver.Factory.Simplex(getterMethod, setterMethod)); }
@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) ); }
@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 ); } }
@RuntimeType public static Object intercept( @Origin Method method, @AllArguments Object[] args, @FieldValue("liveObjectLiveMap") RMap<?, ?> map ) throws Exception { throw new UnsupportedOperationException("Please use RLiveObjectService instance for this type of functions"); } }
/** * Installs a given type for use on a {@link net.bytebuddy.implementation.bind.annotation.Pipe} * annotation. The given type must be an interface without any super interfaces and a single method which * maps an {@link java.lang.Object} type to another {@link java.lang.Object} type. The use of generics is * permitted. * * @param typeDescription The type to install. * @return A binder for the {@link net.bytebuddy.implementation.bind.annotation.Pipe} * annotation. */ public static TargetMethodAnnotationDrivenBinder.ParameterBinder<Pipe> install(TypeDescription typeDescription) { return new Binder(onlyMethod(typeDescription)); }
/** * Installs a given type for use on a {@link net.bytebuddy.implementation.bind.annotation.Morph} * annotation. The given type must be an interface without any super interfaces and a single method which * maps an {@link java.lang.Object} array to a {@link java.lang.Object} type. The use of generics is * permitted. * * @param typeDescription The type to install. * @return A binder for the {@link net.bytebuddy.implementation.bind.annotation.Morph} * annotation. */ public static TargetMethodAnnotationDrivenBinder.ParameterBinder<Morph> install(TypeDescription typeDescription) { return new Binder(onlyMethod(typeDescription)); }
/** * {@inheritDoc} */ public ParameterBinding<?> bind(MethodDescription source, Implementation.Target implementationTarget, Assigner assigner) { return parameterBinder.bind(annotation, source, target, implementationTarget, assigner, typing); } }
/** * {@inheritDoc} */ public ByteCodeAppender appender(Target implementationTarget) { return new Appender(implementationTarget); }
/** * {@inheritDoc} */ public ByteCodeAppender appender(Target implementationTarget) { return new Appender(implementationTarget); }
/** * Creates a binder for binding a fixed value to a given annotation. * * @param type The type of the annotation that is bound by this binder. * @param value The value that is assigned to any annotated parameter. * @param <V> The bound annotation's type. * @return A parameter binder that binds the given annotation to the supplied value. */ public static <V extends Annotation> ParameterBinder<V> of(Class<V> type, Object value) { return new OfConstant<V>(type, value); }
/** * {@inheritDoc} */ public ByteCodeAppender appender(Target implementationTarget) { return new Appender(implementationTarget); }
/** * {@inheritDoc} */ public ByteCodeAppender appender(Target implementationTarget) { return new Appender(implementationTarget); }
/** * Creates a new binder for a {@link FieldProxy} in duplex mode. * * @param proxyType The proxy type. * @param getterMethod The getter method. * @param setterMethod The setter method. */ protected Binder(TypeDescription proxyType, MethodDescription.InDefinedShape getterMethod, MethodDescription.InDefinedShape setterMethod) { this(new FieldResolver.Factory.Duplex(proxyType, getterMethod, setterMethod)); }
/** * {@inheritDoc} */ public ByteCodeAppender appender(Target implementationTarget) { return new Appender(implementationTarget); }
/** * {@inheritDoc} */ public Class<FieldValue> getHandledType() { return delegate.getHandledType(); }
@Override public boolean equals(Object other) { return this == other || other instanceof Argument && parameterIndex == ((Argument) other).value(); }
@RuntimeType public static Object intercept( @Origin Method method, @AllArguments Object[] args, @FieldValue("liveObjectLiveMap") RMap<?, ?> map ) throws Exception { throw new UnsupportedOperationException("Please use RLiveObjectService instance for this type of functions"); } }
/** * {@inheritDoc} */ public MethodDelegationBinder.ParameterBinding<?> bind(AnnotationDescription.Loadable<FieldValue> annotation, MethodDescription source, ParameterDescription target, Implementation.Target implementationTarget, Assigner assigner, Assigner.Typing typing) { return delegate.bind(annotation, source, target, implementationTarget, assigner, typing); }