?? subscribevalidator.java.svn-base
字號:
package com.google.code.rsser.web.validator;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.validation.Errors;import org.springframework.validation.Validator;import com.google.code.rsser.model.Feed;import com.google.code.rsser.service.FeedService;import com.google.code.rsser.service.UserService;public class SubscribeValidator implements Validator{ @Autowired protected FeedService feedService; @Autowired protected UserService userService; public boolean supports(Class clazz) { return Feed.class.equals(clazz); } public void validate(Object obj, Errors errors) { Feed feed = (Feed) obj; if (feedService.isFeedSubscribed(userService.getCurrent(), feed.getFeedUrl())) { errors.reject("subscription.alreadySubscribed"); } } }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -