MVC框架实现7---Smart框架Converter接口设计和实现

来源:互联网 发布:php开发oa系统 编辑:程序博客网 时间:2024/06/06 04:16

Converter接口:

package com.smart.converter;public interface Converter {public Object convert( String... strValue ) throws Exception;}
Interger类型实现:举一反三

package com.smart.converter;import com.smart.exception.IllAugumentNumberException;public class IntegerConverter implements Converter {@Overridepublic Object convert(String... strValue) throws Exception {if( strValue.length > 1 )throw new IllAugumentNumberException();return Integer.parseInt(strValue[0]);}}


原创粉丝点击