/** * Returns a {@link CommandResultMessage} containg the result of command processing. * * @param serializer the serializer to deserialize the result with * @return a {@link CommandResultMessage} containing the return value of command processing */ public CommandResultMessage<?> getCommandResultMessage(Serializer serializer) { Object payload = deserializePayload(serializer); RemoteExceptionDescription exceptionDescription = deserializeException(serializer); SerializedMetaData<byte[]> serializedMetaData = new SerializedMetaData<>(this.serializedMetaData, byte[].class); MetaData metaData = serializer.deserialize(serializedMetaData); if (exceptionDescription != null) { return new GenericCommandResultMessage<>(new RemoteHandlingException(exceptionDescription), metaData); } return new GenericCommandResultMessage<>(payload, metaData); }
/** * Returns the error of the command processing. If {@link #isSuccess()} return {@code true}, this * method returns {@code null}. * * @param serializer The serializer to deserialize the result with * @return The exception thrown during command processing */ public Throwable getError(Serializer serializer) { if (success || resultType == null) { return null; } return (Throwable) deserializeResult(serializer); }
@Override @SuppressWarnings("unchecked") public CommandResultMessage<R> getCommandResultMessage(Serializer serializer) { return (CommandResultMessage<R>) super.getCommandResultMessage(serializer); } }
/** * Returns the returnValue of the command processing. If {@link #isSuccess()} return {@code false}, this * method returns {@code null}. This method also returns {@code null} if response processing returned * a {@code null} value. * * @param serializer The serializer to deserialize the result with * @return The return value of command processing */ public Object getReturnValue(Serializer serializer) { if (!success || resultType == null) { return null; } return deserializeResult(serializer); }
/** * Returns a {@link CommandResultMessage} containg the result of command processing. * * @param serializer the serializer to deserialize the result with * @return a {@link CommandResultMessage} containing the return value of command processing */ public CommandResultMessage<?> getCommandResultMessage(Serializer serializer) { Object payload = deserializePayload(serializer); RemoteExceptionDescription exceptionDescription = deserializeException(serializer); SerializedMetaData<byte[]> serializedMetaData = new SerializedMetaData<>(this.serializedMetaData, byte[].class); MetaData metaData = serializer.deserialize(serializedMetaData); if (exceptionDescription != null) { return new GenericCommandResultMessage<>(new RemoteHandlingException(exceptionDescription), metaData); } return new GenericCommandResultMessage<>(payload, metaData); }