subscribevalidator.java
来自「google的开源项目」· Java 代码 · 共 32 行
JAVA
32 行
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 + =
减小字号Ctrl + -
显示快捷键?