Source:
<code>public byte[] encode(final int concurrencyKey, final EhcacheEntityMessage message) throws MessageCodecException { if (message instanceof EhcacheSyncMessage) { EhcacheSyncMessage syncMessage = (EhcacheSyncMessage) message; StructEncoder<Void> encoder; switch (syncMessage.getMessageType()) { case STATE: { encoder = STATE_SYNC_STRUCT.encoder(); EhcacheStateSyncMessage stateSyncMessage = (EhcacheStateSyncMessage)syncMessage; encoder.enm(SYNC_MESSAGE_TYPE_FIELD_NAME, STATE); encodeServerSideConfiguration(encoder, stateSyncMessage.getConfiguration()); encoder.structs(STORES_SUB_STRUCT, stateSyncMessage.getStoreConfigs().entrySet(), (storeEncoder, storeEntry) -> { storeEncoder.string(SERVER_STORE_NAME_FIELD, storeEntry.getKey()); codecUtils.encodeServerStoreConfiguration(storeEncoder, storeEntry.getValue()); }); return encoder.encode().array(); } case DATA: { encoder = DATA_SYNC_STRUCT.encoder(); EhcacheDataSyncMessage dataSyncMessage = (EhcacheDataSyncMessage)syncMessage; encoder.enm(SYNC_MESSAGE_TYPE_FIELD_NAME, DATA); encoder.string(SERVER_STORE_NAME_FIELD, dataSyncMessage.getCacheId()); <START> StructArrayEncoder entriesEncoder = encoder.structs(CHAIN_MAP_ENTRIES_SUB_STRUCT); <END> for (Map.Entry<Long, Chain> entry : dataSyncMessage.getChainMap().entrySet()) { entriesEncoder.int64(KEY_FIELD, entry.getKey()); chainCodec.encode(entriesEncoder.struct(CHAIN_FIELD), entry.getValue()); entriesEncoder.next(); } entriesEncoder.end(); return encoder.encode().array(); } default: throw new IllegalArgumentException("Sync message codec can not encode " + syncMessage.getMessageType()); } } else { throw new IllegalArgumentException(this.getClass().getName() + " can not encode " + message + " which is not a " + EhcacheStateSyncMessage.class); } }</code><technical_language>generic type StructArrayEncoder here</technical_language>

Target:
public byte[] encode(final int concurrencyKey, final EhcacheEntityMessage message) throws MessageCodecException { if (message instanceof EhcacheSyncMessage) { EhcacheSyncMessage syncMessage = (EhcacheSyncMessage) message; StructEncoder<Void> encoder; switch (syncMessage.getMessageType()) { case STATE: { encoder = STATE_SYNC_STRUCT.encoder(); EhcacheStateSyncMessage stateSyncMessage = (EhcacheStateSyncMessage)syncMessage; encoder.enm(SYNC_MESSAGE_TYPE_FIELD_NAME, STATE); encodeServerSideConfiguration(encoder, stateSyncMessage.getConfiguration()); encoder.structs(STORES_SUB_STRUCT, stateSyncMessage.getStoreConfigs().entrySet(), (storeEncoder, storeEntry) -> { storeEncoder.string(SERVER_STORE_NAME_FIELD, storeEntry.getKey()); codecUtils.encodeServerStoreConfiguration(storeEncoder, storeEntry.getValue()); }); return encoder.encode().array(); } case DATA: { encoder = DATA_SYNC_STRUCT.encoder(); EhcacheDataSyncMessage dataSyncMessage = (EhcacheDataSyncMessage)syncMessage; encoder.enm(SYNC_MESSAGE_TYPE_FIELD_NAME, DATA); encoder.string(SERVER_STORE_NAME_FIELD, dataSyncMessage.getCacheId()); encoder.structs(CHAIN_MAP_ENTRIES_SUB_STRUCT, dataSyncMessage.getChainMap().entrySet(), (entryEncoder, entry) -> { entryEncoder.int64(KEY_FIELD, entry.getKey()); chainCodec.encode(entryEncoder.struct(CHAIN_FIELD), entry.getValue()); }); return encoder.encode().array(); } default: throw new IllegalArgumentException("Sync message codec can not encode " + syncMessage.getMessageType()); } } else { throw new IllegalArgumentException(this.getClass().getName() + " can not encode " + message + " which is not a " + EhcacheStateSyncMessage.class); } }