RemoteInvocation(Result) explicitly designed for JavaBean-style deserialization
Issue: SPR-11337
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,6 +33,9 @@ import org.springframework.util.ClassUtils;
|
||||
* <p>This is an SPI class, typically not used directly by applications.
|
||||
* Can be subclassed for additional invocation parameters.
|
||||
*
|
||||
* <p>Both {@link RemoteInvocation} and {@link RemoteInvocationResult} are designed
|
||||
* for use with standard Java serialization as well as JavaBean-style serialization.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 25.02.2004
|
||||
* @see RemoteInvocationResult
|
||||
@@ -59,9 +62,13 @@ public class RemoteInvocation implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* Create a new RemoteInvocation for use as JavaBean.
|
||||
* Create a new RemoteInvocation for the given AOP method invocation.
|
||||
* @param methodInvocation the AOP invocation to convert
|
||||
*/
|
||||
public RemoteInvocation() {
|
||||
public RemoteInvocation(MethodInvocation methodInvocation) {
|
||||
this.methodName = methodInvocation.getMethod().getName();
|
||||
this.parameterTypes = methodInvocation.getMethod().getParameterTypes();
|
||||
this.arguments = methodInvocation.getArguments();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,18 +84,16 @@ public class RemoteInvocation implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new RemoteInvocation for the given AOP method invocation.
|
||||
* @param methodInvocation the AOP invocation to convert
|
||||
* Create a new RemoteInvocation for JavaBean-style deserialization
|
||||
* (e.g. with Jackson).
|
||||
*/
|
||||
public RemoteInvocation(MethodInvocation methodInvocation) {
|
||||
this.methodName = methodInvocation.getMethod().getName();
|
||||
this.parameterTypes = methodInvocation.getMethod().getParameterTypes();
|
||||
this.arguments = methodInvocation.getArguments();
|
||||
public RemoteInvocation() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the name of the target method.
|
||||
* <p>This setter is intended for JavaBean-style deserialization.
|
||||
*/
|
||||
public void setMethodName(String methodName) {
|
||||
this.methodName = methodName;
|
||||
@@ -103,6 +108,7 @@ public class RemoteInvocation implements Serializable {
|
||||
|
||||
/**
|
||||
* Set the parameter types of the target method.
|
||||
* <p>This setter is intended for JavaBean-style deserialization.
|
||||
*/
|
||||
public void setParameterTypes(Class<?>[] parameterTypes) {
|
||||
this.parameterTypes = parameterTypes;
|
||||
@@ -117,6 +123,7 @@ public class RemoteInvocation implements Serializable {
|
||||
|
||||
/**
|
||||
* Set the arguments for the target method call.
|
||||
* <p>This setter is intended for JavaBean-style deserialization.
|
||||
*/
|
||||
public void setArguments(Object[] arguments) {
|
||||
this.arguments = arguments;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,6 +26,9 @@ import java.lang.reflect.InvocationTargetException;
|
||||
* <p>This is an SPI class, typically not used directly by applications.
|
||||
* Can be subclassed for additional invocation parameters.
|
||||
*
|
||||
* <p>Both {@link RemoteInvocation} and {@link RemoteInvocationResult} are designed
|
||||
* for use with standard Java serialization as well as JavaBean-style serialization.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.1
|
||||
* @see RemoteInvocation
|
||||
@@ -59,6 +62,26 @@ public class RemoteInvocationResult implements Serializable {
|
||||
this.exception = exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new RemoteInvocationResult for JavaBean-style deserialization
|
||||
* (e.g. with Jackson).
|
||||
* @see #setValue
|
||||
* @see #setException
|
||||
*/
|
||||
public RemoteInvocationResult() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the result value returned by a successful invocation of the
|
||||
* target method, if any.
|
||||
* <p>This setter is intended for JavaBean-style deserialization.
|
||||
* Use {@link #RemoteInvocationResult(Object)} otherwise.
|
||||
* @see #RemoteInvocationResult()
|
||||
*/
|
||||
public void setValue(Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the result value returned by a successful invocation
|
||||
@@ -69,6 +92,17 @@ public class RemoteInvocationResult implements Serializable {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the exception thrown by an unsuccessful invocation of the
|
||||
* target method, if any.
|
||||
* <p>This setter is intended for JavaBean-style deserialization.
|
||||
* Use {@link #RemoteInvocationResult(Throwable)} otherwise.
|
||||
* @see #RemoteInvocationResult()
|
||||
*/
|
||||
public void setException(Throwable exception) {
|
||||
this.exception = exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the exception thrown by an unsuccessful invocation
|
||||
* of the target method, if any.
|
||||
@@ -81,7 +115,7 @@ public class RemoteInvocationResult implements Serializable {
|
||||
/**
|
||||
* Return whether this invocation result holds an exception.
|
||||
* If this returns {@code false}, the result value applies
|
||||
* (even if {@code null}).
|
||||
* (even if it is {@code null}).
|
||||
* @see #getValue
|
||||
* @see #getException
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user