must implement the inherited abstract 怎么解决出错信息:must implement the inherited abstractmethod
must implement the inherited abstract 怎么解决 出错信息: must implement the inherited abstract method TypeConverter.convertIfNecessary(Object, Class<T>, Field)
public SimpleTypeConverter getSimpleTypeConverter() { return simpleTypeConverters.get(); }
protected SimpleTypeConverter createSimpleTypeConverter() { // simpleTypeConverter is not for concurrency! SimpleTypeConverter simpleTypeConverter = new SimpleTypeConverter(); simpleTypeConverter.useConfigValueEditors(); simpleTypeConverter.registerCustomEditor(Date.class, new DateEditor(Date.class)); simpleTypeConverter.registerCustomEditor(java.sql.Date.class, new DateEditor( java.sql.Date.class));
simpleTypeConverter.registerCustomEditor(java.sql.Time.class, new DateEditor( java.sql.Time.class)); simpleTypeConverter.registerCustomEditor(java.sql.Timestamp.class, new DateEditor( java.sql.Timestamp.class)); return simpleTypeConverter; }
@Override public <T> T convertIfNecessary(Object arg0, Class<T> arg1) throws TypeMismatchException { // TODO Auto-generated method stub return null; }
@Override public <T> T convertIfNecessary(Object arg0, Class<T> arg1, MethodParameter arg2) throws TypeMismatchException { // TODO Auto-generated method stub return null; }
@Override public <T> T convertIfNecessary(Object arg0, Class<T> arg1, Field arg2) throws TypeMismatchException { // TODO Auto-generated method stub return null; } }
[解决办法] public Object convertIfNecessary(Object value, Class requiredType) throws TypeMismatchException { return simpleTypeConverters.get().convertIfNecessary(value, requiredType); }
@SuppressWarnings("unchecked") //@Override public Object convertIfNecessary(Object value, Class requiredType, MethodParameter methodParam) throws TypeMismatchException { return simpleTypeConverters.get().convertIfNecessary(value, requiredType, methodParam); } 报错: Multiple markers at this line - Method convertIfNecessary(Object, Class) has the same erasure convertIfNecessary(Object, Class<T>) as another method in type ThreadSafedSimpleTypeConverter - implements org.springframework.beans.TypeConverter.convertIfNecessary - Class is a raw type. References to generic type Class<T> should be parameterized
@Override public <T> T convertIfNecessary(Object arg0, Class<T> arg1) throws TypeMismatchException { // TODO Auto-generated method stub return null; }
@Override public <T> T convertIfNecessary(Object arg0, Class<T> arg1, MethodParameter arg2) throws TypeMismatchException { // TODO Auto-generated method stub return null; } 报错; Method convertIfNecessary(Object, Class<T>, MethodParameter) has the same erasure convertIfNecessary(Object, Class<T>, MethodParameter) as another method in type ThreadSafedSimpleTypeConverter