You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Mario Ivankovits <ma...@ops.co.at> on 2009/07/24 07:48:59 UTC

RE: svn commit: r797267 - in /commons/proper/configuration/trunk/src/java/org/apache/commons/configuration: FileSystem.java VFSFileSystem.java

Hi!

 
> Modified:
> commons/proper/configuration/trunk/src/java/org/apache/commons/configur
> ation/VFSFileSystem.java
 
> -    private FileSystemOptions setHttpOptions(FileSystemOptions opts,
> Map map)
> +    private void setProperty(FileSystemConfigBuilder builder,
> FileSystemOptions options,
> +                             String key, Object value)
>      {
> -        setDefaultOptions(opts, map);
> +        String methodName = "set" + key.substring(0,1).toUpperCase() +
> key.substring(1);
> +        Class[] paramTypes = new Class[2];
> +        paramTypes[0] = FileSystemOptions.class;
> +        paramTypes[1] = value.getClass();

Hmmm ... I am not quite sure of the rest of the code, but did you see the DelegatingFileSystemOptionsBuilder [1]?

It also sets the configuration using reflection based on just strings.


Ciao,
Mario


[1] http://commons.apache.org/vfs/apidocs/org/apache/commons/vfs/util/DelegatingFileSystemOptionsBuilder.html


Re: svn commit: r797267 - in /commons/proper/configuration/trunk/src/java/org/apache/commons/configuration: FileSystem.java VFSFileSystem.java

Posted by Ralph Goers <ra...@dslextreme.com>.
On Jul 23, 2009, at 10:48 PM, Mario Ivankovits wrote:

> Hi!
>
>
>> Modified:
>> commons/proper/configuration/trunk/src/java/org/apache/commons/ 
>> configur
>> ation/VFSFileSystem.java
>
>> -    private FileSystemOptions setHttpOptions(FileSystemOptions opts,
>> Map map)
>> +    private void setProperty(FileSystemConfigBuilder builder,
>> FileSystemOptions options,
>> +                             String key, Object value)
>>     {
>> -        setDefaultOptions(opts, map);
>> +        String methodName = "set" +  
>> key.substring(0,1).toUpperCase() +
>> key.substring(1);
>> +        Class[] paramTypes = new Class[2];
>> +        paramTypes[0] = FileSystemOptions.class;
>> +        paramTypes[1] = value.getClass();
>
> Hmmm ... I am not quite sure of the rest of the code, but did you  
> see the DelegatingFileSystemOptionsBuilder [1]?
>
> It also sets the configuration using reflection based on just strings.
>

Frankly, I had forgotten all about it. To be honest (and I think I've  
said this before), the way the config builders work has always been my  
least favorite part of the code.  I just took a look at the class and  
have two problems with it. 1) It is a lot more complicated than this  
simple piece of code and 2) it doesn't support passing arbitrary  
objects as parameter values.

Ralph

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