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

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

Go to download

The bndlib project is a general library to be used with OSGi bundles. It contains lots of cool functionality that calculates dependencies, etc.

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

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

public class CharacterHandler extends Handler {

	@Override
	void encode(Encoder app, Object object, Map visited) throws Exception {
		Character c = (Character) object;
		int v = c.charValue();
		app.append(v + "");
	}

	@Override
	Object decode(Decoder dec, boolean s) {
		return s ? 't' : 'f';
	}

	@Override
	Object decode(Decoder dec, String s) {
		return (char) Integer.parseInt(s);
	}

	@Override
	Object decode(Decoder dec, Number s) {
		return (char) s.shortValue();
	}

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy