org.knowm.xchange.coinbase.dto.serialization.EnumFromStringHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xchange-coinbase Show documentation
Show all versions of xchange-coinbase Show documentation
XChange implementation for Coinbase
package org.knowm.xchange.coinbase.dto.serialization;
import java.util.HashMap;
import java.util.Map;
/** @author jamespedwards42 */
public class EnumFromStringHelper> {
private final Map fromString = new HashMap<>();
public EnumFromStringHelper(Class enumClass) {
for (T enumVal : enumClass.getEnumConstants())
fromString.put(enumVal.toString().toLowerCase(), enumVal);
}
public EnumFromStringHelper addJsonStringMapping(String jsonString, final T enumVal) {
fromString.put(jsonString, enumVal);
return this;
}
public T fromJsonString(String jsonString) {
return fromString.get(jsonString.toLowerCase());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy