com.bolyartech.forge.base.exchange.ExchangeOutcome Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of base Show documentation
Show all versions of base Show documentation
Forge framework client base
The newest version!
/*
* Copyright (C) 2012-2016 Ognyan Bankov
*
* 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
*
* http://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 com.bolyartech.forge.base.exchange;
/**
* Represents outcome of an exchange
*
* @param Type of the result of the exchange
* thread safety: full (this object is immutable)
*/
public class ExchangeOutcome {
private final Exchange mExchange;
private final T mResult;
private final boolean mError;
/**
* Creates new ExchangeOutcome
*
* @param exchange {@link Exchange} that was executed
* @param result Result of the exchange of type T
if exchange execution was successful
* @param error indicates if there was an error during exchange execution. If true
may be null
*/
@SuppressWarnings("unused")
public ExchangeOutcome(Exchange exchange, T result, boolean error) {
super();
mExchange = exchange;
mResult = result;
mError = error;
}
/**
* @return true
if there was error in exchange execution, false
otherwise
*/
@SuppressWarnings("unused")
public boolean isError() {
return mError;
}
/**
* @return executed exchange
*/
@SuppressWarnings("unused")
public Exchange getExchange() {
return mExchange;
}
/**
* @return Result ot the exchange of type T
*/
@SuppressWarnings("unused")
public T getResult() {
return mResult;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy