Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #17023
| From | markspace <-@.> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Type of a generic class? |
| Date | 2012-08-02 20:08 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <jvffbg$mvl$1@dont-email.me> (permalink) |
| References | <qivqe9-k9.ln1@whirlwind.fredriksson.dy.fi> <jveq7j$2mo$1@dont-email.me> <j0fre9-61u.ln1@whirlwind.fredriksson.dy.fi> |
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.
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@fredriksson.dy.fi> - 2012-08-02 22:04 +0300
Re: Type of a generic class? Lew <lewbloch@gmail.com> - 2012-08-02 14:01 -0700
Re: Type of a generic class? markspace <-@.> - 2012-08-02 14:08 -0700
Re: Type of a generic class? Donkey Hottie <donkey@fredriksson.dy.fi> - 2012-08-03 02:27 +0300
Re: Type of a generic class? Lew <lewbloch@gmail.com> - 2012-08-02 16:51 -0700
Re: Type of a generic class? markspace <-@.> - 2012-08-02 20:08 -0700
Re: Type of a generic class? Donkey Hottie <donkey@fredriksson.dy.fi> - 2012-08-03 17:25 +0300
Re: Type of a generic class? Donkey Hottie <donkey@fredriksson.dy.fi> - 2012-08-04 13:46 +0300
csiph-web