001 /* 002 * Copyright 2002-2004 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 005 * use this file except in compliance with the License. You may obtain a copy of 006 * the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 013 * License for the specific language governing permissions and limitations under 014 * the License. 015 */ 016 package org.springframework.binding.validation; 017 018 import java.util.Set; 019 020 import org.springframework.richclient.core.Severity; 021 022 /** 023 * Interface to be implemented by objects that hold a list of validation results 024 * for a specific object. 025 * 026 * @author Oliver Hutchison 027 * @see org.springframework.binding.validation.support.DefaultValidationResults 028 */ 029 public interface ValidationResults { 030 031 /** 032 * Returns <code>true</code> of there are any validation messages of 033 * <code>Severity.ERROR</code>. 034 */ 035 boolean getHasErrors(); 036 037 /** 038 * Returns <code>true</code> of there are any validation messages of 039 * <code>Severity.WARNING</code>. 040 */ 041 boolean getHasWarnings(); 042 043 /** 044 * Returns <code>true</code> of there are any validation messages of 045 * <code>Severity.INFO</code>. 046 */ 047 boolean getHasInfo(); 048 049 /** 050 * Returns the total number of validation messages. 051 */ 052 int getMessageCount(); 053 054 /** 055 * Returns the total number of validation messages of the specified 056 * Severity. 057 */ 058 int getMessageCount(Severity severity); 059 060 /** 061 * Returns the total number of validation messages that apply to the 062 * specified property name. 063 */ 064 int getMessageCount(String propertyName); 065 066 /** 067 * Returns a set holding all of the validation messages. 068 */ 069 Set getMessages(); 070 071 /** 072 * Returns a set holding all of the validation messages of the specified 073 * Severity. 074 */ 075 Set getMessages(Severity severity); 076 077 /** 078 * Returns a set holding all of the validation messages that apply to the 079 * specified property name. 080 */ 081 Set getMessages(String propertyName); 082 }