package net.openhft.chronicle.map;

import net.openhft.chronicle.engine.client.ClientWiredStatelessTcpConnectionHub;
import net.openhft.chronicle.wire.CoreFields;
import net.openhft.chronicle.wire.ParameterizeWireKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * Created by Rob Austin
 */
public abstract class MapStatelessClient< E extends ParameterizeWireKey> extends AbstactStatelessClient<E> {

    /**
     * @param channelName
     * @param hub
     * @param type        the type of wire handler for example "MAP" or "QUEUE"
     * @param cid         used by proxies such as the entry-set
     */
    public MapStatelessClient(@NotNull String channelName,
                              @NotNull ClientWiredStatelessTcpConnectionHub hub,
                              @NotNull String type,
                              long cid) {
        super(channelName, hub, type, cid);

    }

    @Nullable
    protected <R> R proxyReturnTypedObject(
            @NotNull final E eventId,
            @NotNull final Class<R> resultType,
            @Nullable Object... args) {

        return proxyReturnWireConsumerInOut(eventId,
                CoreFields.reply, toParameters(eventId, args),
                f -> f.object(resultType));

    }


}

@@ -211,16 +211,59 @@
 ireKey;%0A
+import net.openhft.chronicle.wire.ValueIn;%0A
 import o
@@ -340,16 +340,53 @@
 lable;%0A%0A
+import java.util.function.Function;%0A%0A
 /**%0A * C
@@ -451,17 +451,16 @@
 sClient%3C
- 
 E extend
@@ -1097,32 +1097,58 @@
 inal E eventId,%0A
+            R usingValue,%0A
             @Not
@@ -1216,24 +1216,280 @@
 .. args) %7B%0A%0A
+        Function%3CValueIn, R%3E consumerIn = resultType == CharSequence.class && usingValue != null%0A                ? f -%3E %7B%0A            f.text((StringBuilder) usingValue);%0A            return usingValue;%0A        %7D%0A                : f -%3E f.object(resultType);%0A
         retu
@@ -1562,16 +1562,32 @@
 s.reply,
+%0A               
  toParam
@@ -1628,43 +1628,25 @@
     
-f -%3E f.object(resultType)
+consumerIn
 );%0A
-%0A
     %7D%0A
-%0A%0A
 %7D%0A

fix tests for chronicle map on engine.