commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject cvs commit: jakarta-commons/betwixt/src/java/org/apache/commons/betwixt XMLIntrospector.java
Date Sat, 26 Oct 2002 14:30:54 GMT
mvdb        2002/10/26 07:30:54

  Modified:    betwixt/src/java/org/apache/commons/betwixt
                        XMLIntrospector.java
  Log:
  Added a setter to enable the use of the beanInfoSearchPath again. The default will still
be not to use the beanInfoSearchPath.
  
  Revision  Changes    Path
  1.10      +32 -5     jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/XMLIntrospector.java
  
  Index: XMLIntrospector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/XMLIntrospector.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XMLIntrospector.java	14 Aug 2002 20:26:22 -0000	1.9
  +++ XMLIntrospector.java	26 Oct 2002 14:30:54 -0000	1.10
  @@ -137,6 +137,8 @@
        */
       private NameMapper attributeNameMapper;
       
  +    private boolean useBeanInfoSearchPath = false;
  +    
       /** Base constructor */
       public XMLIntrospector() {
       }
  @@ -194,8 +196,12 @@
         */
       public XMLBeanInfo introspect(Class aClass) throws IntrospectionException {
           // we first reset the beaninfo searchpath.
  -        String[] searchPath = Introspector.getBeanInfoSearchPath();
  -        Introspector.setBeanInfoSearchPath(new String[] { });
  +        String[] searchPath = null;
  +        if (!useBeanInfoSearchPath)
  +        {
  +            searchPath = Introspector.getBeanInfoSearchPath();
  +            Introspector.setBeanInfoSearchPath(new String[] { });
  +        }
           
           XMLBeanInfo xmlInfo = null;
           if ( cachingEnabled ) {
  @@ -224,8 +230,11 @@
           if (log.isTraceEnabled()) {
               log.trace(xmlInfo);
           }
  -        // we restore the beaninfo searchpath.
  -        Introspector.setBeanInfoSearchPath(searchPath);
  +        if (!useBeanInfoSearchPath)
  +        {
  +            // we restore the beaninfo searchpath.
  +            Introspector.setBeanInfoSearchPath(searchPath);
  +        }
           
           return xmlInfo;
       }
  @@ -525,4 +534,22 @@
       public boolean isPrimitiveType(Class type) {
           return XMLIntrospectorHelper.isPrimitiveType(type);
       }
  +    /**
  +     * By default it will be false.
  +     * 
  +     * @return boolean if the beanInfoSearchPath should be used.
  +     */
  +    public boolean useBeanInfoSearchPath() {
  +        return useBeanInfoSearchPath;
  +    }
  +
  +    /**
  +     * Specifies if you want to use the beanInfoSearchPath 
  +     * @see java.beans.Introspector for more details
  +     * @param useBeanInfoSearchPath 
  +     */
  +    public void setUseBeanInfoSearchPath(boolean useBeanInfoSearchPath) {
  +        this.useBeanInfoSearchPath = useBeanInfoSearchPath;
  +    }
  +
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message