io.sphere.sdk.attributes.EnumLikeSetAttributeMapperImpl Maven / Gradle / Ivy
package io.sphere.sdk.attributes;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import io.sphere.sdk.models.WithKey;
import java.util.Set;
import static java.util.stream.Collectors.toSet;
class EnumLikeSetAttributeMapperImpl extends AttributeMapperImpl> {
EnumLikeSetAttributeMapperImpl(final TypeReference> typeReference) {
super(typeReference);
}
@Override
public JsonNode serialize(final Set t) {
final Set keySet = t.stream().map(elem -> elem.getKey()).collect(toSet());
return mapper().valueToTree(keySet);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy