From 0576fe2654da5f1790c5edec66f10b0cdd015c65 Mon Sep 17 00:00:00 2001 From: Keith Donald Date: Mon, 13 Jul 2009 21:22:59 +0000 Subject: [PATCH] removed experimental stuff --- .../org/springframework/ui/binding/Bound.java | 29 ---------------- .../org/springframework/ui/binding/Model.java | 34 ------------------- .../AnnotatedModelBinderConfigurer.java | 33 ------------------ .../BindAndValidateLifecycleTests.java | 6 +--- 4 files changed, 1 insertion(+), 101 deletions(-) delete mode 100644 org.springframework.context/src/main/java/org/springframework/ui/binding/Bound.java delete mode 100644 org.springframework.context/src/main/java/org/springframework/ui/binding/Model.java delete mode 100644 org.springframework.context/src/main/java/org/springframework/ui/binding/support/AnnotatedModelBinderConfigurer.java diff --git a/org.springframework.context/src/main/java/org/springframework/ui/binding/Bound.java b/org.springframework.context/src/main/java/org/springframework/ui/binding/Bound.java deleted file mode 100644 index 60d0b0643b6..00000000000 --- a/org.springframework.context/src/main/java/org/springframework/ui/binding/Bound.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2004-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. - */ -package org.springframework.ui.binding; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target({ElementType.METHOD, ElementType.FIELD}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface Bound { - -} diff --git a/org.springframework.context/src/main/java/org/springframework/ui/binding/Model.java b/org.springframework.context/src/main/java/org/springframework/ui/binding/Model.java deleted file mode 100644 index 628e907e984..00000000000 --- a/org.springframework.context/src/main/java/org/springframework/ui/binding/Model.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2004-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. - */ -package org.springframework.ui.binding; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target({ElementType.TYPE}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface Model { - - /** - * The name of the model - */ - String value() default ""; - -} diff --git a/org.springframework.context/src/main/java/org/springframework/ui/binding/support/AnnotatedModelBinderConfigurer.java b/org.springframework.context/src/main/java/org/springframework/ui/binding/support/AnnotatedModelBinderConfigurer.java deleted file mode 100644 index 0592a569278..00000000000 --- a/org.springframework.context/src/main/java/org/springframework/ui/binding/support/AnnotatedModelBinderConfigurer.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.springframework.ui.binding.support; - -import java.beans.BeanInfo; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.lang.reflect.Method; - -import org.springframework.core.annotation.AnnotationUtils; -import org.springframework.ui.binding.Bound; - -final class AnnotatedModelBinderConfigurer { - - public void configure(GenericBinder binder) { - Class modelClass = binder.getModel().getClass(); - BeanInfo beanInfo; - try { - beanInfo = Introspector.getBeanInfo(modelClass); - } catch (IntrospectionException e) { - throw new IllegalStateException("Unable to introspect model " + binder.getModel(), e); - } - // TODO do we have to still flush introspector cache here? - for (PropertyDescriptor prop : beanInfo.getPropertyDescriptors()) { - Method getter = prop.getReadMethod(); - Bound b = AnnotationUtils.getAnnotation(getter, Bound.class); - if (b != null) { - // TODO should we wire formatter here if using a format annotation - an optimization? - binder.addBinding(prop.getName()); - } - } - } - -} diff --git a/org.springframework.context/src/test/java/org/springframework/ui/lifecycle/BindAndValidateLifecycleTests.java b/org.springframework.context/src/test/java/org/springframework/ui/lifecycle/BindAndValidateLifecycleTests.java index 92754d48f42..262cf235c87 100644 --- a/org.springframework.context/src/test/java/org/springframework/ui/lifecycle/BindAndValidateLifecycleTests.java +++ b/org.springframework.context/src/test/java/org/springframework/ui/lifecycle/BindAndValidateLifecycleTests.java @@ -14,8 +14,6 @@ import org.springframework.ui.alert.Alert; import org.springframework.ui.alert.Alerts; import org.springframework.ui.alert.Severity; import org.springframework.ui.alert.support.DefaultAlertContext; -import org.springframework.ui.binding.Bound; -import org.springframework.ui.binding.Model; import org.springframework.ui.binding.support.WebBinder; import org.springframework.ui.format.number.CurrencyFormat; import org.springframework.ui.validation.ValidationFailure; @@ -277,14 +275,12 @@ public class BindAndValidateLifecycleTests { } - @Model(value="testBean") public class TestAnnotatedBean { private String editable; private String notEditable; - @Bound public String getEditable() { return editable; } @@ -292,7 +288,7 @@ public class BindAndValidateLifecycleTests { public void setEditable(String editable) { this.editable = editable; } - + public String getNotEditable() { return notEditable; }