java.lang.Number is an abstract class. We need to make an instance of the object. We can refer to the Double elsewhere as a Number, but we still need to instantiate it as something concrete (such as Double or Integer).
-Mark ----- Original Message ----- From: "Frank Sauer" <[EMAIL PROTECTED]> To: "jaxen" <[EMAIL PROTECTED]> Sent: Friday, October 19, 2001 11:21 AM Subject: RE: [Jaxen] number() > Why not use the java.util.Number class instead? > Who cares if it's an Integer or a Double if all > we do is comparing? > > Frank Sauer > > -----Original Message----- > From: Mark A. Belonga [mailto:[EMAIL PROTECTED]] > Sent: Friday, October 19, 2001 12:14 PM > To: jaxen > Subject: [Jaxen] number() > > > All, > > Currently, number( value ) will convert the value to a Double only if it is > already a Double or if it is a string with a decimal place. If it has no > decimal place, it will convert value to an Integer. > > This causes problems when you do something like: > > number( '4' ) < number( '12.0' ) (same for '>' as well). > > Which causes a ClassCastException since we're using compareTo (see Integer > javadocs). > > I suggest that number ALWAYS converts to a Double. Does anyone disagree? Is > there any reason we would *not* want to convert to Double? > > -Mark > > > > > _______________________________________________ > Jaxen-interest mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jaxen-interest > > _______________________________________________ > Jaxen-interest mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jaxen-interest _______________________________________________ Jaxen-interest mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jaxen-interest