* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
packageorg.springframework.ui.format.support;
importjava.lang.reflect.Method;
importjava.lang.reflect.Modifier;
importjava.util.Locale;
importorg.springframework.ui.format.Formatter;
importorg.springframework.util.ReflectionUtils;
/**
* A generic Formatter that reflectively invokes methods on a class to carry out format and parse operations.
* The format method should be a public member method that returns a String and either accepts no arguments or a single Locale argument.
* The parse method should be a declared public static method that returns the formattedObjectType and either accepts a single String argument or String and Locale arguments.
* Throws an {@link IllegalArgumentException} if either the format method or parse method could not be resolved.
* Useful for invoking existing Formatter logic on a formattable type without needing a dedicated Formatter class.