Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #17080
| From | "markspace" <markspace@1:261/38.remove-yy0-this> |
|---|---|
| Subject | Re: Type of a generic class? |
| Message-ID | <501C1567.56039.calajapr@time.synchro.net> (permalink) |
| Newsgroups | comp.lang.java.programmer |
| References | <501C1565.56029.calajapr@time.synchro.net> |
| Date | 2012-08-03 18:54 +0000 |
| Organization | tds.net |
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
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Type of a generic class? "Donkey Hottie" <donkey.hottie@1:261/38.remove-yy0-this> - 2012-08-03 18:54 +0000
Re: Type of a generic class? "Lew" <lew@1:261/38.remove-yy0-this> - 2012-08-03 18:54 +0000
Re: Type of a generic class? "markspace" <markspace@1:261/38.remove-yy0-this> - 2012-08-03 18:54 +0000
Re: Type of a generic class? "Donkey Hottie" <donkey.hottie@1:261/38.remove-yy0-this> - 2012-08-03 18:54 +0000
Re: Type of a generic class? "Lew" <lew@1:261/38.remove-yy0-this> - 2012-08-03 18:54 +0000
Re: Type of a generic class? "markspace" <markspace@1:261/38.remove-yy0-this> - 2012-08-03 18:54 +0000
Re: Type of a generic class? "Donkey Hottie" <donkey.hottie@1:261/38.remove-yy0-this> - 2012-08-03 18:54 +0000
Re: Type of a generic class? "Donkey Hottie" <donkey.hottie@1:261/38.remove-5qr-this> - 2012-08-04 18:41 +0000
csiph-web