db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpoes...@apache.org
Subject cvs commit: db-torque/src/java/org/apache/torque/om SimpleKey.java NumberKey.java
Date Tue, 27 May 2003 19:35:04 GMT
mpoeschl    2003/05/27 12:35:03

  Modified:    src/java/org/apache/torque/om Tag: TORQUE_3_0_BRANCH
                        SimpleKey.java NumberKey.java
  Log:
  TRQS118: Generated OM doesn't compile when using FLOAT as primary key
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.1   +11 -1     db-torque/src/java/org/apache/torque/om/SimpleKey.java
  
  Index: SimpleKey.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/om/SimpleKey.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- SimpleKey.java	25 Sep 2002 05:46:51 -0000	1.4
  +++ SimpleKey.java	27 May 2003 19:35:02 -0000	1.4.2.1
  @@ -99,6 +99,16 @@
        * @param key the key value
        * @return a SimpleKey
        */    
  +    public static SimpleKey keyFor(double key)
  +    {
  +        return new NumberKey(key);
  +    }
  +
  +    /**
  +     * Creates a SimpleKey equivalent to key
  +     * @param key the key value
  +     * @return a SimpleKey
  +     */    
       public static SimpleKey keyFor(Number key)
       {
           return new NumberKey(key);
  
  
  
  1.14.2.1  +14 -12    db-torque/src/java/org/apache/torque/om/NumberKey.java
  
  Index: NumberKey.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/om/NumberKey.java,v
  retrieving revision 1.14
  retrieving revision 1.14.2.1
  diff -u -r1.14 -r1.14.2.1
  --- NumberKey.java	26 Nov 2002 22:32:55 -0000	1.14
  +++ NumberKey.java	27 May 2003 19:35:03 -0000	1.14.2.1
  @@ -3,7 +3,7 @@
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -125,13 +125,23 @@
   
       /**
        * Creates a NumberKey equivalent to <code>key</code>.
  -     * Convenience only. Not very efficient at all.
  +     *
  +     * @param key the key value
  +     */
  +    public NumberKey(double key)
  +    {
  +        this.key = new BigDecimal(key);
  +    }
  +
  +    /**
  +     * Creates a NumberKey equivalent to <code>key</code>.
  +     * Convenience only.
        *
        * @param key the key value
        */
       public NumberKey(int key)
       {
  -        this.key = new BigDecimal(new Integer(key).toString());
  +        this((long) key);
       }
   
       /**
  @@ -251,8 +261,6 @@
       /**
        * @param o the comparison value
        * @return a numeric comparison of the two values
  -     * @throws NullPointerException when the value of the NumberKey or the
  -     *         comparison value is null
        */
       public int compareTo(Object o)
       {
  @@ -280,7 +288,6 @@
        * {@link java.math.BigDecimal.byteValue()}
        *
        * @return the NumberKey converted to a byte
  -     * @throws NullPointerException when the value of the NumberKey is null
        */
       public byte byteValue()
       {
  @@ -298,7 +305,6 @@
        * opposite sign.
        *
        * @return the NumberKey converted to an int
  -     * @throws NullPointerException when the value of the NumberKey is null
        */
       public int intValue()
       {
  @@ -315,7 +321,6 @@
        * precision of the NumberKey value as well as return a result with the
        * opposite sign.
        *
  -     * @throws NullPointerException when the value of the NumberKey is null
        * @return the NumberKey converted to a short
        */
       public short shortValue()
  @@ -329,7 +334,6 @@
        * {@link java.math.BigDecimal.intValue()}
        *
        * @return the NumberKey converted to a long
  -     * @throws NullPointerException when the value of the NumberKey is null
        */
       public long longValue()
       {
  @@ -345,7 +349,6 @@
        * or Float.POSITIVE_INFINITY as appropriate.
        *
        * @return the NumberKey converted to a float
  -     * @throws NullPointerException when the value of the NumberKey is null
        */
       public float floatValue()
       {
  @@ -361,7 +364,6 @@
        * or Double.POSITIVE_INFINITY as appropriate.
        *
        * @return the NumberKey converted to a double
  -     * @throws NullPointerException when the value of the NumberKey is null
        */
       public double doubleValue()
       {
  
  
  

Mime
View raw message