[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/preferences ...
Christian Bauer
christian at hibernate.org
Tue Jun 12 08:30:05 EDT 2007
User: cbauer
Date: 07/06/12 08:30:05
Modified: examples/wiki/src/main/org/jboss/seam/wiki/preferences
PreferenceProperty.java Preference.java
PreferenceRegistry.java PreferenceSupport.java
PreferenceComponent.java
Log:
Completed first iteration of search engine
Revision Changes Path
1.2 +7 -1 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/preferences/PreferenceProperty.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PreferenceProperty.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/preferences/PreferenceProperty.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- PreferenceProperty.java 2 Apr 2007 18:25:05 -0000 1.1
+++ PreferenceProperty.java 12 Jun 2007 12:30:05 -0000 1.2
@@ -20,13 +20,15 @@
private String name;
private String description;
+ private Class type;
private PreferenceVisibility visibility;
private boolean fieldAccess;
private PreferenceComponent preferenceComponent;
- public PreferenceProperty(String name, String description, PreferenceVisibility visibility, boolean fieldAccess, PreferenceComponent preferenceComponent) {
+ public PreferenceProperty(String name, String description, Class type, PreferenceVisibility visibility, boolean fieldAccess, PreferenceComponent preferenceComponent) {
this.name = name;
this.description = description;
+ this.type = type;
this.visibility = visibility;
this.fieldAccess = fieldAccess;
this.preferenceComponent = preferenceComponent;
@@ -40,6 +42,10 @@
return description;
}
+ public Class getType() {
+ return type;
+ }
+
public PreferenceVisibility getVisibility() {
return visibility;
}
1.2 +1 -1 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/preferences/Preference.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Preference.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/preferences/Preference.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Preference.java 2 Apr 2007 18:25:05 -0000 1.1
+++ Preference.java 12 Jun 2007 12:30:05 -0000 1.2
@@ -24,7 +24,7 @@
*
* @author Christian Bauer
*/
- at Target({ElementType.TYPE, ElementType.FIELD})
+ at Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Preference {
String description();
1.2 +2 -0 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/preferences/PreferenceRegistry.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PreferenceRegistry.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/preferences/PreferenceRegistry.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- PreferenceRegistry.java 2 Apr 2007 18:25:05 -0000 1.1
+++ PreferenceRegistry.java 12 Jun 2007 12:30:05 -0000 1.2
@@ -29,6 +29,8 @@
@Create
public void scanPreferenceComponents() {
+ log.debug("initializing preference registry");
+
// Register the meta model by scanning components with @Preference annotation
String[] boundNames = Contexts.getApplicationContext().getNames();
1.5 +3 -0 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/preferences/PreferenceSupport.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PreferenceSupport.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/preferences/PreferenceSupport.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- PreferenceSupport.java 26 Apr 2007 05:29:18 -0000 1.4
+++ PreferenceSupport.java 12 Jun 2007 12:30:05 -0000 1.5
@@ -26,6 +26,9 @@
* <tt>#{seamNameOfThePreferenceComponent.prefProperty}</tt> if there are property accessor methods, or even
* type-safe by getting the whole <tt>#{seamNameOfThePreferenceComponent}</tt> injected.
* <p>
+ * Note that you should add <tt>@NotNull</tt> to any preference property that is critical in addition to any
+ * other pattern, length, range, or other validator annotations.
+ * <p>
* Subclasses should be in <tt>CONVERSATION</tt> or <tt>PAGE</tt> scope.
* <p>
* Subclasses automatically read preference properties when they are instantiated for the current conversation or page.
1.2 +5 -2 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/preferences/PreferenceComponent.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PreferenceComponent.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/preferences/PreferenceComponent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- PreferenceComponent.java 2 Apr 2007 18:25:05 -0000 1.1
+++ PreferenceComponent.java 12 Jun 2007 12:30:05 -0000 1.2
@@ -35,6 +35,7 @@
String propertyName;
String propertyDescription;
+ Class propertyType;
PreferenceVisibility propertyVisibility;
// @Preference setter methods
@@ -48,10 +49,11 @@
propertyName = Introspector.decapitalize(methodName.substring(3));
propertyDescription = method.getAnnotation(Preference.class).description();
+ propertyType = method.getReturnType();
propertyVisibility = method.getAnnotation(Preference.class).visibility();
PreferenceProperty property =
- new PreferenceProperty(propertyName, propertyDescription, propertyVisibility, false, this);
+ new PreferenceProperty(propertyName, propertyDescription, propertyType, propertyVisibility, false, this);
properties.add(property);
propertiesByName.put(property.getName(), property);
}
@@ -64,10 +66,11 @@
propertyName = field.getName();
propertyDescription = field.getAnnotation(Preference.class).description();
+ propertyType = field.getType();
propertyVisibility = field.getAnnotation(Preference.class).visibility();
PreferenceProperty property =
- new PreferenceProperty(propertyName, propertyDescription, propertyVisibility, true, this);
+ new PreferenceProperty(propertyName, propertyDescription, propertyType, propertyVisibility, true, this);
properties.add(property);
propertiesByName.put(property.getName(), property);
}
More information about the jboss-cvs-commits
mailing list