You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by de...@struts.apache.org on 2004/09/24 21:37:43 UTC

[Apache Struts Wiki] Updated: StrutsCatalogInstrumentableForms

   Date: 2004-09-24T12:37:43
   Editor: MichaelMcGrady <mi...@michaelmcgrady.com>
   Wiki: Apache Struts Wiki
   Page: StrutsCatalogInstrumentableForms
   URL: http://wiki.apache.org/struts/StrutsCatalogInstrumentableForms

   no comment

Change Log:

------------------------------------------------------------------------------
@@ -1,55 +1 @@
-StrutsCatalog: '''Provide a multipurpose form that can be instrumented.'''
-
-'''IN ORDER TO USE THIS YOU HAVE TO USE CLASSES THAT ARE NOT READILY AVAILABLE.  IF YOU ARE INTERESTED, PLEASE CONTACT ME AT mike@michaelmcgrady.com.'''
-
-This !BeanMapForm class allows you to instrument your !ActionForms and use them as dynamic property setters and getters as well.  (The size 89 is chosen because the series created by x = 2x + 1 stays prime for a considerable time, e.g. 89, 179, 359, ''etc''.  This maximizes the benefits of the lookup algorithms.)  You don't have to use this class as a form, of course.  You can use it just for the dynamic property setters and getters and instrument that, if you like, or not.  But, there are lots of reasons to instrument action forms and this allows you to do that.
-
-You instrument such forms, of course, by subclassing !BeanMapForm.  Check Joshua Bloch's ''Effective Java'', Item 14 (favor composition over inheritance), p. 71 ''et seq'', to understand the intricacies involved with instrumentation and collection classes.
-
-Also, cf. ["StrutsCatalogVariableScreenFields"] and http://jakarta.apache.org/struts/faqs/indexedprops.html
-
-{{{   
-public class BeanMapForm 
-    extends    ActionForm 
-    implements Map {
-  private Map map;
-
-  public BeanMapForm() {
-    int size = 89;
-    this.map = Collections.synchronizedMap(new HashMap(size));
-  }
-
-  public void setMap(Map map) {
-    this.map = map;
-  }
-
-  public Map getMap() {
-    return map;
-  }
-
-  public void setProperty(Object key, Object value) {
-    map.put(key,value);
-  }
-
-  public Object getProperty(Object key) {
-    return map.get(key);
-  }
-
-  public void       clear()                       { map.clear(); }
-  public boolean    containsKey(Object key)       { return map.containsKey(key);}
-  public boolean    containsValue(Object value)   { return map.containsValue(value); }
-  public Set        entrySet()                    { return map.entrySet(); }
-  public boolean    equals(Object object)         { return map.equals(object); }
-  public Object     get(Object key)               { return map.get(key); }
-  public int        hashCode()                    { return map.hashCode(); }
-  public boolean    isEmpty()                     { return map.isEmpty(); }
-  public Set        keySet()                      { return map.keySet(); }
-  public Object     put(Object key, Object value) { return map.put(key,value); }
-  public void       putAll(Map map)               { map.putAll(map); }
-  public Object     remove(Object key)            { return map.remove(key); }
-  public int        size()                        { return map.size(); }
-  public Collection values()                      { return map.values(); }
-  public String     toString()                    { return "BeanMapForm[" + map.toString() + "]"; }
-} ///;-)
-}}}
--- Michael !McGrady
+Please see the following for the code [http://www.michaelmcgrady.com/]

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


RE: [Apache Struts Wiki] Updated: StrutsCatalogInstrumentableForms

Posted by Steve Raeburn <sr...@apache.org>.
Michael,

Could you please link to the relevant content directly, rather than your
homepage? This would make it easier for readers to find the content they are
interested in.

If you just want to link to your homepage, then I think a single reference,
from a relevant spot on the Wiki would be more appropriate.

Thanks

Steve


> -----Original Message-----
> From: dev@struts.apache.org [mailto:dev@struts.apache.org]
> Sent: September 24, 2004 12:38 PM
> To: dev@struts.apache.org
> Subject: [Apache Struts Wiki] Updated: StrutsCatalogInstrumentableForms
>
>
>    Date: 2004-09-24T12:37:43
>    Editor: MichaelMcGrady <mi...@michaelmcgrady.com>
>    Wiki: Apache Struts Wiki
>    Page: StrutsCatalogInstrumentableForms
>    URL: http://wiki.apache.org/struts/StrutsCatalogInstrumentableForms
>
>    no comment
>
> Change Log:
>
> ------------------------------------------------------------------
> ------------
> @@ -1,55 +1 @@
> -StrutsCatalog: '''Provide a multipurpose form that can be
> instrumented.'''
> -
> -'''IN ORDER TO USE THIS YOU HAVE TO USE CLASSES THAT ARE NOT
> READILY AVAILABLE.  IF YOU ARE INTERESTED, PLEASE CONTACT ME AT
> mike@michaelmcgrady.com.'''
> -
> -This !BeanMapForm class allows you to instrument your
> !ActionForms and use them as dynamic property setters and getters
> as well.  (The size 89 is chosen because the series created by x
> = 2x + 1 stays prime for a considerable time, e.g. 89, 179, 359,
> ''etc''.  This maximizes the benefits of the lookup algorithms.)
> You don't have to use this class as a form, of course.  You can
> use it just for the dynamic property setters and getters and
> instrument that, if you like, or not.  But, there are lots of
> reasons to instrument action forms and this allows you to do that.
> -
> -You instrument such forms, of course, by subclassing
> !BeanMapForm.  Check Joshua Bloch's ''Effective Java'', Item 14
> (favor composition over inheritance), p. 71 ''et seq'', to
> understand the intricacies involved with instrumentation and
> collection classes.
> -
> -Also, cf. ["StrutsCatalogVariableScreenFields"] and
> http://jakarta.apache.org/struts/faqs/indexedprops.html
> -
> -{{{
> -public class BeanMapForm
> -    extends    ActionForm
> -    implements Map {
> -  private Map map;
> -
> -  public BeanMapForm() {
> -    int size = 89;
> -    this.map = Collections.synchronizedMap(new HashMap(size));
> -  }
> -
> -  public void setMap(Map map) {
> -    this.map = map;
> -  }
> -
> -  public Map getMap() {
> -    return map;
> -  }
> -
> -  public void setProperty(Object key, Object value) {
> -    map.put(key,value);
> -  }
> -
> -  public Object getProperty(Object key) {
> -    return map.get(key);
> -  }
> -
> -  public void       clear()                       { map.clear(); }
> -  public boolean    containsKey(Object key)       { return
> map.containsKey(key);}
> -  public boolean    containsValue(Object value)   { return
> map.containsValue(value); }
> -  public Set        entrySet()                    { return
> map.entrySet(); }
> -  public boolean    equals(Object object)         { return
> map.equals(object); }
> -  public Object     get(Object key)               { return
> map.get(key); }
> -  public int        hashCode()                    { return
> map.hashCode(); }
> -  public boolean    isEmpty()                     { return
> map.isEmpty(); }
> -  public Set        keySet()                      { return
> map.keySet(); }
> -  public Object     put(Object key, Object value) { return
> map.put(key,value); }
> -  public void       putAll(Map map)               { map.putAll(map); }
> -  public Object     remove(Object key)            { return
> map.remove(key); }
> -  public int        size()                        { return map.size(); }
> -  public Collection values()                      { return
> map.values(); }
> -  public String     toString()                    { return
> "BeanMapForm[" + map.toString() + "]"; }
> -} ///;-)
> -}}}
> --- Michael !McGrady
> +Please see the following for the code [http://www.michaelmcgrady.com/]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org