All Downloads are FREE. Search and download functionalities are using the official Maven repository.

aQute.lib.json.EnumHandler Maven / Gradle / Ivy

Go to download

A command line utility and Ant plugin to wrap, build, or examine bundles.

There is a newer version: 2.4.0
Show newest version
package aQute.lib.json;

import java.io.*;
import java.lang.reflect.*;
import java.util.*;

public class EnumHandler extends Handler {
	@SuppressWarnings("rawtypes")
	final Class	type;

	public EnumHandler(Class< ? > type) {
		this.type = type;
	}

	@Override
	void encode(Encoder app, Object object, Map visited) throws IOException, Exception {
		StringHandler.string(app, object.toString());
	}

	@Override
	@SuppressWarnings("unchecked")
	Object decode(Decoder dec, String s) throws Exception {
		return Enum.valueOf(type, s);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy