commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Torsten Curdt" <tcu...@apache.org>
Subject Re: [compress] Draft 6
Date Sat, 13 May 2006 07:22:18 GMT
> > if (".zip".equals(extension)) -> ArchiveType.ZIP.newInstance();
> > if (".rar".equals(extension)) -> ArchiveType.RAR.newInstance();
> > ...
> >
> > in you code - which is cumbersome IMO.
>
> In that situation you'd use: ArchiveType.valueOf(extension).newInstance()

...so what's the benefit over the usual factory + constructor
instantiation then?

 Archive arch = new TarArchive(new File("my.tar"));
 Archive arch = ArchiveFactory.newInstance(new File("my.tar");
 Archive arch = ArchiveFactory.newInstance("tar");

cheers
--
Torsten

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


Mime
View raw message