Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #17015

Re: Type of a generic class?

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Type of a generic class?
Date 2012-08-02 16:51 -0700
Organization http://groups.google.com
Message-ID <7828b4d7-9c03-484f-8853-7ab541c4395e@googlegroups.com> (permalink)
References <qivqe9-k9.ln1@whirlwind.fredriksson.dy.fi> <jveq7j$2mo$1@dont-email.me> <j0fre9-61u.ln1@whirlwind.fredriksson.dy.fi>

Show all headers | View raw


Donkey Hottie wrote:
> markspace kirjoitti:
>> ...

> I am trying to convert a simple { String name, String value } pair in

How about a Map<String, Global<?>>

Also, you should move that if-chain reflection out of your app and 
use polymorphism instead.

> database to a Global<T>(name) so that it will convert the Java simple
> datatypes to a string and back. This is for system parameters,
> configuration parameters.
> 
>> 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..

Using strings to look up types is not strong typing.

> 
> The back end of the system parameters is simply
> 
> 
> 
> CREATE TABLE SystemParameters
> (
>     name varchar(64) not null primary_key,
>     value varchar(512)
> ) ;
> 
> 
> That's it. That is have the table is given to me. But I want to make the
> Java code bit more pedantic on the types of the parameters it uses and
> maintains.

JPA does that for you, too.

Anyway, your use of reflection is anti-pedantic.

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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