org.opensprout.osaf.model.support.MemberValidator.java Source code

Java tutorial

Introduction

Here is the source code for org.opensprout.osaf.model.support.MemberValidator.java

Source

/**
 * Copyright (c) 2008 OpenSprout Team.
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 */
package org.opensprout.osaf.model.support;

import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

/**
 * Sample
 * @author Whiteship
 *
 */
@Component
public class MemberValidator implements Validator {

    public boolean supports(Class clazz) {
        return true;
    }

    public void validate(Object target, Errors errors) {
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "required", "");
    }

}