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

org.oddjob.arooa.convert.convertlets.ShortConvertlets Maven / Gradle / Ivy

There is a newer version: 1.6.0
Show newest version
/*
 * (c) Rob Gordon 2006
 */
package org.oddjob.arooa.convert.convertlets;

import org.oddjob.arooa.convert.ConversionProvider;
import org.oddjob.arooa.convert.ConversionRegistry;
import org.oddjob.arooa.convert.Convertlet;
import org.oddjob.arooa.convert.FinalConvertlet;

public class ShortConvertlets implements ConversionProvider {

	public void registerWith(ConversionRegistry registry) {
		
		registry.register(Number.class, Short.class, 
				new Convertlet() {
			public Short convert(Number from) {
				return new Short(from.shortValue());
			};
		});
		
		registry.register(String.class, Short.class, 
				new Convertlet() {
			public Short convert(String from) {
				return new Short(from);
			}
		});
		
		registry.register(Short.class, String.class, 
				new FinalConvertlet() {
			public String convert(Short from) {
				return from.toString();
			}
		});
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy