1. /*
  2. * Copyright 2002-2004 the original author or authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.springframework.context;
  17. /**
  18. * Interface for objects that are suitable for message resolution in a
  19. * MessageSource. Spring's own validation error classes implement this
  20. * interface.
  21. * @author Juergen Hoeller
  22. * @see MessageSource#getMessage(MessageSourceResolvable, java.util.Locale)
  23. * @see org.springframework.validation.ObjectError
  24. * @see org.springframework.validation.FieldError
  25. */
  26. public interface MessageSourceResolvable {
  27. /**
  28. * Return the codes to be used to resolve this message, in the order that
  29. * they should get tried. The last code will therefore be the default one.
  30. * @return a String array of codes which are associated with this message
  31. */
  32. public String[] getCodes();
  33. /**
  34. * Return the array of arguments to be used to resolve this message.
  35. * @return an array of objects to be used as parameters to replace
  36. * placeholders within the message text
  37. * @see <a href="http://java.sun.com/j2se/1.3/docs/api/java/text/MessageFormat.html">java.text.MessageFormat</a>
  38. */
  39. public Object[] getArguments();
  40. /**
  41. * Return the default message to be used to resolve this message.
  42. * @return the default message, or null if no default
  43. */
  44. public String getDefaultMessage();
  45. }