001/* 002 * Copyright 2002-2012 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://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, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.context; 018 019/** 020 * Interface for objects that are suitable for message resolution in a 021 * {@link MessageSource}. 022 * 023 * <p>Spring's own validation error classes implement this interface. 024 * 025 * @author Juergen Hoeller 026 * @see MessageSource#getMessage(MessageSourceResolvable, java.util.Locale) 027 * @see org.springframework.validation.ObjectError 028 * @see org.springframework.validation.FieldError 029 */ 030public interface MessageSourceResolvable { 031 032 /** 033 * Return the codes to be used to resolve this message, in the order that 034 * they should get tried. The last code will therefore be the default one. 035 * @return a String array of codes which are associated with this message 036 */ 037 String[] getCodes(); 038 039 /** 040 * Return the array of arguments to be used to resolve this message. 041 * @return an array of objects to be used as parameters to replace 042 * placeholders within the message text 043 * @see java.text.MessageFormat 044 */ 045 Object[] getArguments(); 046 047 /** 048 * Return the default message to be used to resolve this message. 049 * @return the default message, or {@code null} if no default 050 */ 051 String getDefaultMessage(); 052 053}