simplebyteconverter.java

来自「pojo的mvc框架」· Java 代码 · 共 37 行

JAVA
37
字号
package xyz.frame.converter.basic;import xyz.frame.LogicRequest;import xyz.frame.converter.ConversionException;import xyz.frame.converter.Converter;/** * Simple byte converter. * Uses the error key invalid_byte if unable to parse its information. *  * @author Guilherme Silveira */public class SimpleByteConverter implements Converter {	public Object convert(String value, Class<?> type, LogicRequest context)			throws ConversionException {		if (value == null || value.equals("")) {			return null;		}		try {			return Byte.valueOf(value);		} catch (NumberFormatException e) {			throw new ConversionException("invalid_byte", e.getMessage(), e);		}	}	/**	 * Returns the list of supported types	 * 	 * @see xyz.frame.converter.Converter#getSupportedTypes()	 */	public Class<?>[] getSupportedTypes() {		return new Class[] { Byte.class };	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?