You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by pi...@locus.apache.org on 2000/09/26 02:46:17 UTC

cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler TagCache.java

pierred     00/09/25 17:46:17

  Modified:    jasper/src/share/org/apache/jasper/compiler TagCache.java
  Log:
  Support for PropertyEditor's [JSP1.2]
  - now caches the PropertyEditor classes associated with
    the properties of a tag
  
  Revision  Changes    Path
  1.2       +16 -2     jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagCache.java
  
  Index: TagCache.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagCache.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TagCache.java	2000/08/12 00:52:08	1.1
  +++ TagCache.java	2000/09/26 00:46:17	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagCache.java,v 1.1 2000/08/12 00:52:08 pierred Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/08/12 00:52:08 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagCache.java,v 1.2 2000/09/26 00:46:17 pierred Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/09/26 00:46:17 $
    *
    * ====================================================================
    * 
  @@ -67,6 +67,7 @@
   import java.beans.BeanInfo;
   import java.beans.Introspector;
   import java.beans.PropertyDescriptor;
  +import java.beans.PropertyEditor;
   import java.beans.IntrospectionException;
   
   import org.apache.jasper.JasperException;
  @@ -77,16 +78,19 @@
    * tag. 
    *
    * @author Anil K. Vijendran (akv@eng.sun.com)
  + * @author Pierre Delisle
    */
   public class TagCache {
       String shortTagName;
       Hashtable methodMaps;
  +    Hashtable propertyEditorMaps;
       BeanInfo tagClassInfo;
       Class tagHandlerClass;
       
       TagCache(String shortTagName) {
           this.shortTagName = shortTagName;
           this.methodMaps = new Hashtable();
  +        this.propertyEditorMaps = new Hashtable();
       }
   
       private void addSetterMethod(String attrName, Method m) {
  @@ -97,6 +101,14 @@
           return (Method) methodMaps.get(attrName);
       }
   
  +    private void addPropertyEditor(String attrName, Class peClass) {
  +        propertyEditorMaps.put(attrName, peClass);
  +    }
  +    
  +    Class getPropertyEditorClass(String attrName) {
  +        return (Class) propertyEditorMaps.get(attrName);
  +    }
  +
       void setTagHandlerClass(Class tagHandlerClass) 
           throws JasperException
       {
  @@ -112,6 +124,8 @@
                   */
                   if (pd[i].getWriteMethod() != null)
                       addSetterMethod(pd[i].getName(), pd[i].getWriteMethod());
  +                if (pd[i].getPropertyEditorClass() != null)
  +                    addPropertyEditor(pd[i].getName(), pd[i].getPropertyEditorClass());
               }
           } catch (IntrospectionException ex) {
               throw new JasperException(Constants.getString("jsp.error.unable.to_introspect",