From 52e75c2d9ed687b3f655750656331e7a13d5f250 Mon Sep 17 00:00:00 2001 From: Keith Donald Date: Thu, 20 Mar 2008 05:59:01 +0000 Subject: [PATCH] not useful --- .../ConverterPropertyEditorAdapter.java | 64 ------------------- 1 file changed, 64 deletions(-) delete mode 100644 spring-binding/src/main/java/org/springframework/binding/convert/support/ConverterPropertyEditorAdapter.java diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/support/ConverterPropertyEditorAdapter.java b/spring-binding/src/main/java/org/springframework/binding/convert/support/ConverterPropertyEditorAdapter.java deleted file mode 100644 index 520e161a..00000000 --- a/spring-binding/src/main/java/org/springframework/binding/convert/support/ConverterPropertyEditorAdapter.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2004-2007 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. - */ -package org.springframework.binding.convert.support; - -import java.beans.PropertyEditorSupport; - -import org.springframework.binding.convert.ConversionExecutor; -import org.springframework.util.Assert; - -/** - * Adapts a Converter to the PropertyEditor interface. - *

- * Note: with a converter, only forward conversion from-string-to-value is supported. Value-to-string conversion is not - * supported. If you need this capability, use a Formatter with a FormatterPropertyEditor adapter. - * - * @see org.springframework.binding.format.Formatter - * @see org.springframework.binding.format.adapters.FormatterPropertyEditor - * - * @author Keith Donald - */ -public class ConverterPropertyEditorAdapter extends PropertyEditorSupport { - - private ConversionExecutor conversionExecutor; - - /** - * Adapt given conversion executor to the PropertyEditor contract. - */ - public ConverterPropertyEditorAdapter(ConversionExecutor conversionExecutor) { - Assert.notNull(conversionExecutor, "A conversion executor is required"); - if (conversionExecutor.getSourceClass() != null) { - Assert.isTrue(conversionExecutor.getSourceClass().equals(String.class), - "A string conversion executor is required"); - } - this.conversionExecutor = conversionExecutor; - } - - /** - * Returns the type strings will be converted to. - */ - public Class getTargetClass() { - return conversionExecutor.getTargetClass(); - } - - public void setAsText(String text) throws IllegalArgumentException { - setValue(conversionExecutor.execute(text)); - } - - public String getAsText() { - throw new UnsupportedOperationException(); - } -} \ No newline at end of file