001package springdao.support; 002 003import org.springframework.util.StringUtils; 004import springdao.RepositoryManager; 005 006/** 007 * 008 * @author Kent Yeh 009 */ 010public class IntDaoPropertyEditor extends DaoPropertyEditor { 011 012 public IntDaoPropertyEditor(RepositoryManager<?> daoManager) { 013 super(daoManager); 014 } 015 016 @Override 017 public void setAsText(String text) throws IllegalArgumentException { 018 try { 019 setValue(StringUtils.hasText(text) ? getDaoManager().findByPrimaryKey(Integer.valueOf(text)) : null); 020 } catch (RuntimeException e) { 021 setValue(null); 022 } 023 } 024}