Revision: 1292
Author: mathiasbr
Date: 2006-08-09 14:53:57 -0700 (Wed, 09 Aug 2006)
ViewCVS: http://svn.sourceforge.net/spring-rich-c/?rev=1292&view=rev
Log Message:
-----------
support annotation for protected fields
Modified Paths:
--------------
trunk/spring-richclient/support/src/main/java/org/springframework/binding/form/support/UserMetadata.java
Added Paths:
-----------
trunk/spring-richclient/tiger/src/main/java/org/springframework/binding/support/ProtectedField.java
trunk/spring-richclient/tiger/src/test/java/org/springframework/binding/support/ProtectedFieldTests.java
Modified:
trunk/spring-richclient/support/src/main/java/org/springframework/binding/form/support/UserMetadata.java
===================================================================
---
trunk/spring-richclient/support/src/main/java/org/springframework/binding/form/support/UserMetadata.java
2006-08-09 21:47:09 UTC (rev 1291)
+++
trunk/spring-richclient/support/src/main/java/org/springframework/binding/form/support/UserMetadata.java
2006-08-09 21:53:57 UTC (rev 1292)
@@ -18,7 +18,6 @@
import org.springframework.binding.form.FieldMetadata;
import org.springframework.binding.form.FormModel;
-
/**
* Class which holds keys for user metadata used in spring rich
*
@@ -33,7 +32,7 @@
* The value must be an instance of [EMAIL PROTECTED] Boolean}, if true
any value of the field will not be displayed either
* through logging or showing value errors
*/
- public static final String PROTECTED_FIELD = UserMetadata.class.getName()
+ ".ProtectedField";
+ public static final String PROTECTED_FIELD =
"org.springframework.binding.support.ProtectedField";
/**
* tests if the usermetadata of the field has a boolean value true for the
key [EMAIL PROTECTED] #PROTECTED_FIELD}
Added:
trunk/spring-richclient/tiger/src/main/java/org/springframework/binding/support/ProtectedField.java
===================================================================
---
trunk/spring-richclient/tiger/src/main/java/org/springframework/binding/support/ProtectedField.java
(rev 0)
+++
trunk/spring-richclient/tiger/src/main/java/org/springframework/binding/support/ProtectedField.java
2006-08-09 21:53:57 UTC (rev 1292)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2002-2006 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.support;
+
+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;
+
+/**
+ * marks a field as protected - usefull for password fields
+ *
+ * @author Mathias Broekelmann
+ */
[EMAIL PROTECTED]
[EMAIL PROTECTED](RetentionPolicy.RUNTIME)
[EMAIL PROTECTED](ElementType.METHOD)
+public @interface ProtectedField {
+}
Property changes on:
trunk/spring-richclient/tiger/src/main/java/org/springframework/binding/support/ProtectedField.java
___________________________________________________________________
Name: svn:keywords
+ Revision Author Date Id
Name: svn:eol-style
+ native
Added:
trunk/spring-richclient/tiger/src/test/java/org/springframework/binding/support/ProtectedFieldTests.java
===================================================================
---
trunk/spring-richclient/tiger/src/test/java/org/springframework/binding/support/ProtectedFieldTests.java
(rev 0)
+++
trunk/spring-richclient/tiger/src/test/java/org/springframework/binding/support/ProtectedFieldTests.java
2006-08-09 21:53:57 UTC (rev 1292)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2002-2006 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.support;
+
+import org.springframework.binding.form.FormModel;
+import org.springframework.binding.form.support.DefaultFormModel;
+import org.springframework.binding.form.support.UserMetadata;
+import org.springframework.richclient.test.SpringRichTestCase;
+
+/**
+ * @author Mathias Broekelmann
+ *
+ */
+public class ProtectedFieldTests extends SpringRichTestCase {
+
+ public static class AnnotatedTestBean {
+ private String password;
+
+ @ProtectedField
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ }
+
+ public void testAnnotation() throws Exception {
+ FormModel model = new DefaultFormModel(new
AnnotationAwareBeanPropertyAccessStrategy(new AnnotatedTestBean()));
+ assertEquals(true,
model.getFieldMetadata("password").getUserMetadata(UserMetadata.PROTECTED_FIELD));
+ }
+}
Property changes on:
trunk/spring-richclient/tiger/src/test/java/org/springframework/binding/support/ProtectedFieldTests.java
___________________________________________________________________
Name: svn:keywords
+ Revision Author Date Id
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
spring-rich-c-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs