Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (683)
Games in Android Showcase (196)
games submitted by our members
Games in WIP (750)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Sun left out something important from their libraries  (Read 2198 times)
0 Members and 1 Guest are viewing this topic.
Offline K.I.L.E.R

Senior Devvie




Java games rock!


« Posted 2006-05-09 14:39:45 »

Integer extends Number
[...] extends Number

So why can't I do this?

numberVariable.parseAsSubClass(string)

Instead I have to do this:

Something<? extends Number> variable;
Class<? extends Number> numberType;

if(numberType == Integer.class)
etc....

Good God at the horrible design. :/
Will Sun ever fix this?

Vorax:
Is there a name for a "redneck" programmer?

Jeff:
Unemployed. Wink
Offline kevglass

« JGO Spiffy Duke »


Medals: 272
Projects: 25
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #1 - Posted 2006-05-09 15:05:03 »

Raise an RFE and they *might* eventually - ask Cas Smiley

Kev

Offline princec

« JGO Spiffy Duke »


Medals: 785
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #2 - Posted 2006-05-09 16:57:46 »

Not entirely sure what he's trying to do here though...

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline AndersDahlberg

Junior Devvie





« Reply #3 - Posted 2006-05-09 20:01:36 »

java.text.NumberFormat.getInstance().parse(string) ?
Offline K.I.L.E.R

Senior Devvie




Java games rock!


« Reply #4 - Posted 2006-05-09 22:13:20 »

Say what?
It's in there?


java.text.NumberFormat.getInstance().parse(string) ?

Vorax:
Is there a name for a "redneck" programmer?

Jeff:
Unemployed. Wink
Offline Ask_Hjorth_Larsen

Junior Devvie




Java games rock!


« Reply #5 - Posted 2006-05-10 21:54:48 »

If you want to read something without actually knowing which kind of number it is, then that must necessarily mean that you're prepared to accept numbers of type double. So how about just parsing any input as a double? Anything can be expressed sensibly as such, so it covers all bases.

EDIT: Ah, of course. Except in the case of BigDecimal and so on.
Offline Riven
Administrator

« JGO Overlord »


Medals: 1228
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #6 - Posted 2006-05-10 22:05:01 »

And you cant fit all longs in a double.

Besides that, I don't see any point in this "RFE".

One can alsways make an utility-class. If sun can do you, you can do it too.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline Ask_Hjorth_Larsen

Junior Devvie




Java games rock!


« Reply #7 - Posted 2006-05-11 14:18:44 »

Another thing is that the parseSomething methods are static, so they don't go well with subclasses.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 
orrenravid (195 views)
2016-07-16 03:57:23

theagentd (267 views)
2016-07-11 14:28:54

Hydroque (351 views)
2016-07-06 05:56:57

Hydroque (506 views)
2016-07-03 08:52:54

GrandCastle (380 views)
2016-07-01 09:13:47

GrandCastle (372 views)
2016-07-01 09:09:45

CopyableCougar4 (426 views)
2016-06-25 16:56:52

Hydroque (406 views)
2016-06-22 02:17:53

SwampChicken (369 views)
2016-06-20 13:22:57

SwampChicken (299 views)
2016-06-20 13:22:49
Making a Dynamic Plugin System
by Hydroque
2016-06-25 00:13:25

Java Data structures
by BinaryMonkL
2016-06-13 21:22:09

Java Data structures
by BinaryMonkL
2016-06-13 21:20:42

FPS Camera Tutorial
by Hydroque
2016-05-22 05:40:58

Website offering 3D Models specifically for games for free
by vusman
2016-05-18 17:23:09

Website offering 3D Models specifically for games for free
by vusman
2016-05-09 08:50:56

Website offering 3D Models specifically for games for free
by vusman
2016-05-06 11:10:21

Website offering 3D Models specifically for games for free
by vusman
2016-04-29 12:56:17
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!