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

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

Go to download

A library to be statically linked. Contains many small utilities. This bundle should not be installed in a framework, it is compile only.

There is a newer version: 7.1.0
Show 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 - 2025 Weber Informatics LLC | Privacy Policy