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

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

The newest version!
package aQute.lib.json;

import java.io.IOException;
import java.lang.reflect.Type;
import java.util.Map;

public class BooleanHandler extends Handler {

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

	@Override
	public Object decode(Decoder dec, boolean s) {
		return s;
	}

	@Override
	public Object decode(Decoder dec, String s) {
		return Boolean.parseBoolean(s);
	}

	@Override
	public Object decode(Decoder dec, Number s) {
		return s.intValue() != 0;
	}

	@Override
	public Object decode(Decoder dec) {
		return false;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy