org.wildfly.clustering.marshalling.protostream.util.EnumMapMarshaller Maven / Gradle / Ivy
/*
* Copyright The WildFly Authors
* SPDX-License-Identifier: Apache-2.0
*/
package org.wildfly.clustering.marshalling.protostream.util;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import org.infinispan.protostream.descriptors.WireType;
import org.wildfly.clustering.marshalling.protostream.Any;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamMarshaller;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamReader;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamWriter;
/**
* Marshaller for an {@link EnumMap}.
* @author Paul Ferraro
* @param the enum key type of this marshaller
*/
public class EnumMapMarshaller> implements ProtoStreamMarshaller> {
static final Field ENUM_MAP_KEY_CLASS_FIELD = Reflect.findField(EnumMap.class, Class.class);
private static final int CLASS_INDEX = 1;
private static final int ELEMENT_INDEX = 2;
@Override
public EnumMap readFrom(ProtoStreamReader reader) throws IOException {
Class enumClass = null;
List