Response.java
/*
* Copyright (C) 2012-2024 RRiBbit.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rribbit;
import java.io.Serializable;
import java.util.Collection;
import org.rribbit.dispatching.RequestDispatcher;
import org.rribbit.processing.RequestProcessor;
/**
* This class represents a response to a {@link Request} that is given back by the {@link RequestProcessor} to the {@link RequestDispatcher}.
* <p />
* The {@link Collection}s in this object should never be null, but may be empty.
* <p />
* This class implements {@link Serializable}, but in order to be truly serializable, the user should make sure that the {@link Object}s in the returnValues are also {@link Serializable}.
*
* @param <T> The type of the return values
*
* @author G.J. Schouten
*
*/
public class Response<T> implements Serializable {
private Collection<T> returnValues;
private Collection<Throwable> throwables;
public Response(Collection<T> returnValues, Collection<Throwable> throwables) {
this.returnValues = returnValues;
this.throwables = throwables;
}
public Collection<T> getReturnValues() {
return returnValues;
}
public Collection<Throwable> getThrowables() {
return throwables;
}
}