org.oddjob.arooa.convert.convertlets.ShortConvertlets Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of arooa Show documentation
Show all versions of arooa Show documentation
A Rip Off Of Ant - A drag and drop component framework.
/*
* (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();
}
});
}
}