// Path: cachedfield/src/main/java/com/byoutline/cachedfield/ErrorListenerWithArg.java
// public interface ErrorListenerWithArg<ARG_TYPE> {
// 
//     void valueLoadingFailed(Exception ex, ARG_TYPE arg);
// }
// 
// Path: cachedfield/src/main/java/com/byoutline/cachedfield/SuccessListenerWithArg.java
// public interface SuccessListenerWithArg<VALUE_TYPE, ARG_TYPE> {
// 
//     void valueLoaded(VALUE_TYPE value, ARG_TYPE arg);
// }
// 
// 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/CallResult.java
// @AutoValue
// public abstract class CallResult<RETURN_TYPE> {
// 
//     public static <RETURN_TYPE> CallResult<RETURN_TYPE> create(@Nullable RETURN_TYPE successResult,
//                                                                @Nullable Exception failureResult) {
//         return new AutoValue_CallResult<RETURN_TYPE>(successResult, failureResult);
//     }
// 
//     @Nullable
//     public abstract RETURN_TYPE getSuccessResult();
// 
//     @Nullable
//     public abstract Exception getFailureResult();
// }
// 
// Path: cachedfield/src/main/java/com/byoutline/cachedfield/cachedendpoint/EndpointState.java
// public enum EndpointState {
//     BEFORE_CALL, DURING_CALL, CALL_SUCCESS, CALL_FAILED;
// 
//     public static FieldState toFieldState(EndpointState state) {
//         switch (state) {
//             case BEFORE_CALL:
//                 return FieldState.NOT_LOADED;
//             case DURING_CALL:
//                 return FieldState.CURRENTLY_LOADING;
//             case CALL_SUCCESS:
//                 return FieldState.LOADED;
//             case CALL_FAILED:
//                 return FieldState.NOT_LOADED;
//             default:
//                 throw new IllegalArgumentException("Unknown state: " + state);
//         }
//     }
// }
// 
// 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();
// }


import com.byoutline.cachedfield.ErrorListenerWithArg;
import com.byoutline.cachedfield.SuccessListenerWithArg;
import com.byoutline.cachedfield.cachedendpoint.CallEndListener;
import com.byoutline.cachedfield.cachedendpoint.CallResult;
import com.byoutline.cachedfield.cachedendpoint.EndpointState;
import com.byoutline.cachedfield.cachedendpoint.StateAndValue;
package com.byoutline.cachedfield.internal.cachedendpoint;


/**
 * @author Sebastian Kacprzak <sebastian.kacprzak at byoutline.com>
 */
public class CallEndWrapperWithArg<RETURN_TYPE, ARG_TYPE> implements SuccessListenerWithArg<RETURN_TYPE, ARG_TYPE>, ErrorListenerWithArg<ARG_TYPE> {
    private final CallEndListener<RETURN_TYPE, ARG_TYPE> listener;

    public CallEndWrapperWithArg(CallEndListener<RETURN_TYPE, ARG_TYPE> listener) {
        this.listener = listener;
    }

    @Override
// Path: cachedfield/src/main/java/com/byoutline/cachedfield/ErrorListenerWithArg.java
// public interface ErrorListenerWithArg<ARG_TYPE> {
// 
//     void valueLoadingFailed(Exception ex, ARG_TYPE arg);
// }
// 
// Path: cachedfield/src/main/java/com/byoutline/cachedfield/SuccessListenerWithArg.java
// public interface SuccessListenerWithArg<VALUE_TYPE, ARG_TYPE> {
// 
//     void valueLoaded(VALUE_TYPE value, ARG_TYPE arg);
// }
// 
// 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/CallResult.java
// @AutoValue
// public abstract class CallResult<RETURN_TYPE> {
// 
//     public static <RETURN_TYPE> CallResult<RETURN_TYPE> create(@Nullable RETURN_TYPE successResult,
//                                                                @Nullable Exception failureResult) {
//         return new AutoValue_CallResult<RETURN_TYPE>(successResult, failureResult);
//     }
// 
//     @Nullable
//     public abstract RETURN_TYPE getSuccessResult();
// 
//     @Nullable
//     public abstract Exception getFailureResult();
// }
// 
// Path: cachedfield/src/main/java/com/byoutline/cachedfield/cachedendpoint/EndpointState.java
// public enum EndpointState {
//     BEFORE_CALL, DURING_CALL, CALL_SUCCESS, CALL_FAILED;
// 
//     public static FieldState toFieldState(EndpointState state) {
//         switch (state) {
//             case BEFORE_CALL:
//                 return FieldState.NOT_LOADED;
//             case DURING_CALL:
//                 return FieldState.CURRENTLY_LOADING;
//             case CALL_SUCCESS:
//                 return FieldState.LOADED;
//             case CALL_FAILED:
//                 return FieldState.NOT_LOADED;
//             default:
//                 throw new IllegalArgumentException("Unknown state: " + state);
//         }
//     }
// }
// 
// 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: cachedfield/src/main/java/com/byoutline/cachedfield/internal/cachedendpoint/CallEndWrapperWithArg.java
import com.byoutline.cachedfield.ErrorListenerWithArg;
import com.byoutline.cachedfield.SuccessListenerWithArg;
import com.byoutline.cachedfield.cachedendpoint.CallEndListener;
import com.byoutline.cachedfield.cachedendpoint.CallResult;
import com.byoutline.cachedfield.cachedendpoint.EndpointState;
import com.byoutline.cachedfield.cachedendpoint.StateAndValue;

package com.byoutline.cachedfield.internal.cachedendpoint;


/**
 * @author Sebastian Kacprzak <sebastian.kacprzak at byoutline.com>
 */
public class CallEndWrapperWithArg<RETURN_TYPE, ARG_TYPE> implements SuccessListenerWithArg<RETURN_TYPE, ARG_TYPE>, ErrorListenerWithArg<ARG_TYPE> {
    private final CallEndListener<RETURN_TYPE, ARG_TYPE> listener;

    public CallEndWrapperWithArg(CallEndListener<RETURN_TYPE, ARG_TYPE> listener) {
        this.listener = listener;
    }

    @Override
    public void valueLoadingFailed(Exception ex, ARG_TYPE arg) {