1 16 17 package org.springframework.remoting.support; 18 19 import java.io.Serializable ; 20 import java.lang.reflect.InvocationTargetException ; 21 22 33 public class RemoteInvocationResult implements Serializable { 34 35 36 private static final long serialVersionUID = 2138555143707773549L; 37 38 39 private Object value; 40 41 private Throwable exception; 42 43 44 49 public RemoteInvocationResult(Object value) { 50 this.value = value; 51 } 52 53 58 public RemoteInvocationResult(Throwable exception) { 59 this.exception = exception; 60 } 61 62 67 public Object getValue() { 68 return this.value; 69 } 70 71 76 public Throwable getException() { 77 return this.exception; 78 } 79 80 87 public boolean hasException() { 88 return (this.exception != null); 89 } 90 91 92 99 public Object recreate() throws Throwable { 100 if (this.exception != null) { 101 Throwable exToThrow = this.exception; 102 if (this.exception instanceof InvocationTargetException ) { 103 exToThrow = ((InvocationTargetException ) this.exception).getTargetException(); 104 } 105 RemoteInvocationUtils.fillInClientStackTraceIfPossible(exToThrow); 106 throw exToThrow; 107 } 108 else { 109 return this.value; 110 } 111 } 112 113 } 114 | Popular Tags |