001 /*
002 * Copyright 2002-2006 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 * 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,
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 package org.springframework.binding.form.support;
017
018 import org.springframework.binding.convert.ConversionContext;
019 import org.springframework.binding.convert.support.AbstractConverter;
020
021 /**
022 * HACK: Copy from the package private converter
023 * org.springframework.binding.convert.support.NoOpConverter
024 * of the spring-binding dependency.
025 *
026 * Converter that is a "no op".
027 *
028 * @author Keith Donald
029 */
030 public class CopiedPublicNoOpConverter extends AbstractConverter {
031
032 private Class sourceClass;
033
034 private Class targetClass;
035
036 public CopiedPublicNoOpConverter(Class sourceClass, Class targetClass) {
037 this.sourceClass = sourceClass;
038 this.targetClass = targetClass;
039 }
040
041 protected Object doConvert(Object source, Class targetClass, ConversionContext context) throws Exception {
042 return source;
043 }
044
045 public Class[] getSourceClasses() {
046 return new Class[] { sourceClass };
047 }
048
049 public Class[] getTargetClasses() {
050 return new Class[] { targetClass };
051 }
052 }