📄 simplecharacterconverter.java
字号:
package xyz.frame.converter.basic;import xyz.frame.LogicRequest;import xyz.frame.converter.ConversionException;import xyz.frame.converter.Converter;/** * Converts to Character. Uses the error key invalid_character if unable to * parse its information. * * @author Guilherme Silveira */public class SimpleCharacterConverter implements Converter { /** * Converts * * @see xyz.frame.converter.Converter#convert(java.lang.String, * java.lang.Class, xyz.frame.scope.LogicRequest) */ public Object convert(String value, Class<?> type, LogicRequest context) throws ConversionException { if (value == null || value.equals("")) { return null; } if (value.length() != 1) { throw new ConversionException("invalid_character", "Content is more than a single character"); } return Character.valueOf(value.charAt(0)); } /** * Returns the list of supported types * * @see xyz.frame.converter.Converter#getSupportedTypes() */ public Class<?>[] getSupportedTypes() { return new Class[] { Character.class }; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -