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 command line utility and Ant plugin to wrap, build, or examine bundles.

The newest version!
package aQute.lib.json;

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

public class BooleanHandler extends Handler {

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

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

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

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

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy