com.dft.api.shopify.model.adapters.EscapedStringsAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shopify-admin-rest Show documentation
Show all versions of shopify-admin-rest Show documentation
Shopify Admin REST API using JDK 11 and Reactive Programming
The newest version!
package com.dft.api.shopify.model.adapters;
import java.util.Collection;
import java.util.stream.Collectors;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import org.apache.commons.text.StringEscapeUtils;
public class EscapedStringsAdapter extends XmlAdapter, Collection> {
@Override
public Collection unmarshal(final Collection escapedStrings) throws Exception {
return (escapedStrings == null) ? null
: escapedStrings.stream().map(StringEscapeUtils::unescapeHtml4).collect(Collectors.toList());
}
@Override
public Collection marshal(final Collection unescapedStrings) throws Exception {
return unescapedStrings;
}
}