001 /*
002 * Copyright 2002-2005 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.form;
017
018 /**
019 * Interface to be implemented by objects that can resolve a FieldFace for a
020 * field path and optionaly a given context.
021 *
022 * @author Oliver Hutchison
023 * @author Mathias Broekelmann
024 * @see org.springframework.binding.form.support.MessageSourceFieldFaceSource
025 */
026 public interface FieldFaceSource {
027
028 /**
029 * Return the FieldFace for the field.
030 *
031 * @param field the form field
032 * @return the FieldFace for the given field (never null).
033 */
034 FieldFace getFieldFace(String field);
035
036 /**
037 * Return the FieldFace for the given field name and a context.
038 *
039 * @param field the field name
040 * @param context optional context for the field face
041 * @return the FieldFace for the given field (never null).
042 * @throws IllegalArgumentException if field is null or empty
043 */
044 FieldFace getFieldFace(String field, Object context);
045 }