aQute.lib.json.EnumHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.bndtools.templating.gitrepo Show documentation
Show all versions of org.bndtools.templating.gitrepo Show documentation
org.bndtools.templating.gitrepo
The newest version!
package aQute.lib.json;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
public class EnumHandler extends Handler {
@SuppressWarnings("rawtypes")
final Class type;
final Map mapping = new HashMap<>();
public EnumHandler(Class> type) {
this.type = type;
for ( Object constant : type.getEnumConstants()) {
String s = JSONCodec.keyword(constant.toString().toLowerCase());
mapping.put(s, constant);
}
}
@Override
public void encode(Encoder app, Object object, Map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy