// Path: cachedfield/src/main/java/com/byoutline/cachedfield/cachedendpoint/CallEndListener.java
// public interface CallEndListener<RETURN_TYPE, ARG_TYPE> {
//     void callEnded(StateAndValue<RETURN_TYPE, ARG_TYPE> callResult);
// }
// 
// Path: cachedfield/src/main/java/com/byoutline/cachedfield/cachedendpoint/StateAndValue.java
// @AutoValue
// public abstract class StateAndValue<VALUE_TYPE, ARG_TYPE> {
// 
//     public static <VALUE_TYPE, ARG_TYPE> StateAndValue<VALUE_TYPE, ARG_TYPE> create(@Nonnull EndpointState state,
//                                                                                     @Nonnull CallResult<VALUE_TYPE> value,
//                                                                                     @Nullable ARG_TYPE arg) {
//         return new AutoValue_StateAndValue<VALUE_TYPE, ARG_TYPE>(state, value, arg);
//     }
// 
//     @Nonnull
//     public abstract EndpointState getState();
// 
//     @Nonnull
//     public abstract CallResult<VALUE_TYPE> getValue();
// 
//     @Nullable
//     public abstract ARG_TYPE getArg();
// }
// 
// Path: ibuscachedfield/src/main/java/com/byoutline/ibuscachedfield/events/ResponseEventWithArg.java
// public interface ResponseEventWithArg<RETURN_TYPE, ARG_TYPE> {
// 
//     /**
//      * @param value    response from server/or calculated value.
//      * @param argValue argument that was used to get value.
//      */
//     void setResponse(RETURN_TYPE value, ARG_TYPE argValue);
// }


import com.byoutline.cachedfield.cachedendpoint.CallEndListener;
import com.byoutline.cachedfield.cachedendpoint.StateAndValue;
import com.byoutline.eventcallback.IBus;
import com.byoutline.ibuscachedfield.events.ResponseEventWithArg;
package com.byoutline.ibuscachedfield.internal;


/**
 * @author Sebastian Kacprzak <sebastian.kacprzak at byoutline.com>
 */
public class BusCallEndListener<RETURN_TYPE, ARG_TYPE> implements CallEndListener<RETURN_TYPE, ARG_TYPE> {
    private final IBus bus;
    private final ResponseEventWithArg<StateAndValue<RETURN_TYPE, ARG_TYPE>, ARG_TYPE> event;

// Path: cachedfield/src/main/java/com/byoutline/cachedfield/cachedendpoint/CallEndListener.java
// public interface CallEndListener<RETURN_TYPE, ARG_TYPE> {
//     void callEnded(StateAndValue<RETURN_TYPE, ARG_TYPE> callResult);
// }
// 
// Path: cachedfield/src/main/java/com/byoutline/cachedfield/cachedendpoint/StateAndValue.java
// @AutoValue
// public abstract class StateAndValue<VALUE_TYPE, ARG_TYPE> {
// 
//     public static <VALUE_TYPE, ARG_TYPE> StateAndValue<VALUE_TYPE, ARG_TYPE> create(@Nonnull EndpointState state,
//                                                                                     @Nonnull CallResult<VALUE_TYPE> value,
//                                                                                     @Nullable ARG_TYPE arg) {
//         return new AutoValue_StateAndValue<VALUE_TYPE, ARG_TYPE>(state, value, arg);
//     }
// 
//     @Nonnull
//     public abstract EndpointState getState();
// 
//     @Nonnull
//     public abstract CallResult<VALUE_TYPE> getValue();
// 
//     @Nullable
//     public abstract ARG_TYPE getArg();
// }
// 
// Path: ibuscachedfield/src/main/java/com/byoutline/ibuscachedfield/events/ResponseEventWithArg.java
// public interface ResponseEventWithArg<RETURN_TYPE, ARG_TYPE> {
// 
//     /**
//      * @param value    response from server/or calculated value.
//      * @param argValue argument that was used to get value.
//      */
//     void setResponse(RETURN_TYPE value, ARG_TYPE argValue);
// }


// Path: ibuscachedfield/src/main/java/com/byoutline/ibuscachedfield/internal/BusCallEndListener.java
import com.byoutline.cachedfield.cachedendpoint.CallEndListener;
import com.byoutline.cachedfield.cachedendpoint.StateAndValue;
import com.byoutline.eventcallback.IBus;
import com.byoutline.ibuscachedfield.events.ResponseEventWithArg;

package com.byoutline.ibuscachedfield.internal;


/**
 * @author Sebastian Kacprzak <sebastian.kacprzak at byoutline.com>
 */
public class BusCallEndListener<RETURN_TYPE, ARG_TYPE> implements CallEndListener<RETURN_TYPE, ARG_TYPE> {
    private final IBus bus;
    private final ResponseEventWithArg<StateAndValue<RETURN_TYPE, ARG_TYPE>, ARG_TYPE> event;

    public BusCallEndListener(IBus bus, ResponseEventWithArg<StateAndValue<RETURN_TYPE, ARG_TYPE>, ARG_TYPE> event) {