com.jsoniter.output.DefaultMapKeyEncoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsoniter Show documentation
Show all versions of jsoniter Show documentation
jsoniter (json-iterator) is fast and flexible JSON parser available in Java and Go
package com.jsoniter.output;
import com.jsoniter.spi.*;
import java.lang.reflect.Type;
class DefaultMapKeyEncoder implements MapKeyEncoder {
public static MapKeyEncoder registerOrGetExisting(Type mapKeyType) {
String cacheKey = JsoniterSpi.getMapKeyEncoderCacheKey(mapKeyType);
MapKeyEncoder mapKeyEncoder = JsoniterSpi.getMapKeyEncoder(cacheKey);
if (null != mapKeyEncoder) {
return mapKeyEncoder;
}
mapKeyEncoder = new DefaultMapKeyEncoder();
JsoniterSpi.addNewMapEncoder(cacheKey, mapKeyEncoder);
return mapKeyEncoder;
}
@Override
public String encode(Object mapKey) {
return mapKey.toString();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy