Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!transit4.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!53ab2750!not-for-mail From: "markspace" Subject: Re: Type of a generic class? Message-ID: <501C1567.56039.calajapr@time.synchro.net> X-Comment-To: Donkey Hottie Newsgroups: comp.lang.java.programmer In-Reply-To: <501C1565.56029.calajapr@time.synchro.net> References: <501C1565.56029.calajapr@time.synchro.net> X-FTN-AREA: COMP.LANG.JAVA.PROGRAMMER X-FTN-MSGID: 1:261/38 b4f68c17 X-FTN-REPLY: 1:261/38 cd329b9a Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.16a-Win32 NewsLink 1.98] Lines: 56 Date: Fri, 03 Aug 2012 18:54:19 GMT NNTP-Posting-Host: 69.21.70.65 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1344020059 69.21.70.65 (Fri, 03 Aug 2012 13:54:19 CDT) NNTP-Posting-Date: Fri, 03 Aug 2012 13:54:19 CDT Organization: tds.net Xref: csiph.com comp.lang.java.programmer:17080 To: Donkey Hottie From: markspace <-@.> On 8/2/2012 4:27 PM, Donkey Hottie wrote: > It is indeed kind of spooky and strange idea, after all what is so wrong > about simple > > String value = SystemProperties.getString("ParamName") ; > > It is OK, but I'm kind of toying with idea of strong typing of System > Parameters: A Date can not be stored as Long or Double etc.. To do something like this, I'd arrange some implementation for the parameter: class Parameter { public void processParam( String param ) { double d = Double.parse( param ); // or whatever... ... } } And then use a Map as Lew suggests or some other method of binding the Parameter class to the string "ParamName". (You could, for example use Class.forName(): Parameter proc = Class.forName( "my.project.parameter."+"ParamName").newInstance(); or you could use annotations: @Parameter("ParamName") class Parameter {... or any other crazy thing you like. It would probably be better than what you have now.) > The back end of the system parameters is simply > > CREATE TABLE SystemParameters > ( > name varchar(64) not null primary_key, > value varchar(512) > ) ; I've written this table definition. In fact it was 23 odd years ago, as in intern while still in college. I don't know if it's good or bad practice, but it seems a common idea. --- BBBS/Li6 v4.10 Dada-1 * Origin: Prism bbs (1:261/38) --- Synchronet 3.16a-Win32 NewsLink 1.98 Time Warp of the Future BBS - telnet://time.synchro.net:24