tech.coinbub.daemon.proxy.converters.HexConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of daemon-utils Show documentation
Show all versions of daemon-utils Show documentation
Common utilities for daemon integrations
The newest version!
package tech.coinbub.daemon.proxy.converters;
import tech.coinbub.daemon.proxy.Converter;
public class HexConverter implements Converter {
@Override
public Object marshal(final Object from) {
if (from instanceof Integer) {
return "0x" + Integer.toHexString((Integer) from);
}
if (from instanceof Long) {
return "0x" + Long.toHexString((Long) from);
}
return null;
}
@Override
public Object unmarshal(final Object from) {
return Long.decode(from.toString());
}
}