mpoeschl    02/04/30 02:22:38

  Modified:    src/java/org/apache/torque/om BaseObject.java ComboKey.java
                        DateKey.java NumberKey.java ObjectKey.java
                        Persistent.java StringKey.java
  Log:
  coding style
  - removed unused imports
  - add {}
  - javadocs
  
  Revision  Changes    Path
  1.11      +22 -26    
jakarta-turbine-torque/src/java/org/apache/torque/om/BaseObject.java
  
  Index: BaseObject.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/om/BaseObject.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- BaseObject.java   26 Apr 2002 23:28:27 -0000      1.10
  +++ BaseObject.java   30 Apr 2002 09:22:38 -0000      1.11
  @@ -65,7 +65,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Frank Y. Kim</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>John D. McNally</a>
  - * @version $Id: BaseObject.java,v 1.10 2002/04/26 23:28:27 jmcnally Exp $
  + * @version $Id: BaseObject.java,v 1.11 2002/04/30 09:22:38 mpoeschl Exp $
    */
   public abstract class BaseObject implements Persistent, Serializable
   {
  @@ -133,7 +133,9 @@
           {
               pkInt = Integer.parseInt(getPrimaryKey().toString());
           }
  -        catch (Exception e) {}
  +        catch (Exception e)
  +        {
  +        }
           return pkInt;
       }
   
  @@ -150,12 +152,14 @@
        */
       public long getPrimaryKeyAsLong()
       {
  -        long pkLong = (long)NEW_ID;
  +        long pkLong = (long) NEW_ID;
           try
           {
               pkLong = Long.parseLong(getPrimaryKey().toString());
           }
  -        catch (Exception e) {}
  +        catch (Exception e)
  +        {
  +        }
           return pkLong;
       }
   
  @@ -197,11 +201,13 @@
        */
       public String getPrimaryKeyAsString()
       {
  -        if (getPrimaryKey() == null) return null;
  +        if (getPrimaryKey() == null)
  +        {
  +            return null;
  +        }
           return getPrimaryKey().toString();
       }
   
  -
       /**
        * Returns whether the object has been modified.
        *
  @@ -224,12 +230,11 @@
           return is_new;
       }
   
  -
       /**
        * Setter for the isNew attribute.  This method will be called
        * by Torque-generated children and Peers.
        *
  -     * @param b, the state of the object.
  +     * @param b the state of the object.
        */
       public void setNew(boolean b)
       {
  @@ -247,13 +252,13 @@
        */
       public void setPrimaryKey(int primaryKey) throws Exception
       {
  -        this.primaryKey = new NumberKey(BigDecimal.valueOf((long)primaryKey));
  +        this.primaryKey = new NumberKey(BigDecimal.valueOf((long) primaryKey));
       }
   
       /**
        * Sets the PrimaryKey for the object as an long.
        *
  -     * @param PrimaryKey The new PrimaryKey for the object.
  +     * @param primaryKey The new PrimaryKey for the object.
        * @exception Exception, This method will not throw any exceptions
        * but this allows for children to override the method more easily
        *
  @@ -267,7 +272,7 @@
       /**
        * Sets the PrimaryKey for the object.
        *
  -     * @param PrimaryKey The new PrimaryKey for the object.
  +     * @param primaryKey The new PrimaryKey for the object.
        * @exception Exception, This method will not throw any exceptions
        * but this allows for children to override the method more easily
        *
  @@ -280,7 +285,7 @@
       /**
        * Sets the PrimaryKey for the object as an Object.
        *
  -     * @param PrimaryKey The new PrimaryKey for the object.
  +     * @param primaryKey The new PrimaryKey for the object.
        * @exception Exception, This method will not throw any exceptions
        * but this allows for children to override the method more easily
        *
  @@ -293,7 +298,7 @@
       /**
        * Sets the PrimaryKey for the object as an Object.
        *
  -     * @param ObjectKey The new PrimaryKey for the object.
  +     * @param primaryKey The new PrimaryKey for the object.
        */
       public void setPrimaryKey(ObjectKey primaryKey) throws Exception
       {
  @@ -318,7 +323,6 @@
           modified = false;
       }
   
  -
       /**
        * Retrieves a field from the object by name. Must be overridden if called.
        * BaseObject's implementation will throw an Error.
  @@ -364,7 +368,7 @@
       {
           if (obj != null && obj instanceof BaseObject)
           {
  -            return equals((BaseObject)obj);
  +            return equals((BaseObject) obj);
           }
           else
           {
  @@ -423,7 +427,7 @@
        */
       protected Category getCategory()
       {
  -             return Category.getInstance(getClass().getName());
  +        return Category.getInstance(getClass().getName());
       }
   
       /**
  @@ -433,11 +437,11 @@
        */
       protected Category log()
       {
  -        if (log == null) 
  +        if (log == null)
           {
               log = Category.getInstance(getClass().getName());
           }
  -             return log;
  +        return log;
       }
   
       /**
  @@ -455,11 +459,3 @@
        */
       public abstract void save(DBConnection dbCon) throws Exception;
   }
  -
  -
  -
  -
  -
  -
  -
  -
  
  
  
  1.6       +10 -9     
jakarta-turbine-torque/src/java/org/apache/torque/om/ComboKey.java
  
  Index: ComboKey.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/om/ComboKey.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ComboKey.java     1 Mar 2002 14:16:01 -0000       1.5
  +++ ComboKey.java     30 Apr 2002 09:22:38 -0000      1.6
  @@ -66,6 +66,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>John McNally</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Daniel Rall</a>
  + * @version $Id: ComboKey.java,v 1.6 2002/04/30 09:22:38 mpoeschl Exp $
    */
   public class ComboKey extends ObjectKey
   {
  @@ -228,7 +229,7 @@
                   }
                   else
                   {
  -                    this.key[i].setValue( (String)tmpKeys.get(i) );
  +                    this.key[i].setValue((String) tmpKeys.get(i));
                   }
               }
           }
  @@ -238,7 +239,7 @@
   
       public void setValue(ComboKey keys)
       {
  -        setValue((SimpleKey[])keys.getValue());
  +        setValue((SimpleKey[]) keys.getValue());
       }
   
   
  @@ -308,10 +309,10 @@
               else if ( keyObj instanceof ComboKey)
               {
                   SimpleKey[] obj = (SimpleKey[])
  -                    ((ComboKey)keyObj).getValue();
  +                    ((ComboKey) keyObj).getValue();
   
  -                SimpleKey[] keys1 = (SimpleKey[])key;
  -                SimpleKey[] keys2 = (SimpleKey[])obj;
  +                SimpleKey[] keys1 = (SimpleKey[]) key;
  +                SimpleKey[] keys2 = (SimpleKey[]) obj;
                   isEqual = keys1.length == keys2.length;
                   for ( int i = 0; i < keys1.length && isEqual; i++)
                   {
  @@ -321,8 +322,8 @@
               else if ( keyObj instanceof SimpleKey[]
                         && key instanceof SimpleKey[] )
               {
  -                SimpleKey[] keys1 = (SimpleKey[])key;
  -                SimpleKey[] keys2 = (SimpleKey[])keyObj;
  +                SimpleKey[] keys1 = (SimpleKey[]) key;
  +                SimpleKey[] keys2 = (SimpleKey[]) keyObj;
                   isEqual = keys1.length == keys2.length;
                   for ( int i = 0; i < keys1.length && isEqual; i++)
                   {
  @@ -337,7 +338,7 @@
       {
           if ( key != null )
           {
  -            SimpleKey[] keys = (SimpleKey[])key;
  +            SimpleKey[] keys = (SimpleKey[]) key;
               for ( int i = 0; i < keys.length; i++)
               {
                   if ( i != 0 )
  @@ -366,7 +367,7 @@
               return super.hashCode();
           }
   
  -        SimpleKey sk = ((SimpleKey[])key)[0];
  +        SimpleKey sk = ((SimpleKey[]) key)[0];
           if ( sk == null )
           {
               return super.hashCode();
  
  
  
  1.6       +14 -3     
jakarta-turbine-torque/src/java/org/apache/torque/om/DateKey.java
  
  Index: DateKey.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/om/DateKey.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DateKey.java      1 Sep 2001 15:58:23 -0000       1.5
  +++ DateKey.java      30 Apr 2002 09:22:38 -0000      1.6
  @@ -55,11 +55,12 @@
    */
   
   import java.util.Date;
  -import org.apache.torque.TorqueException;
   
   /**
    * This class can be used as an ObjectKey to uniquely identify an
    * object within an application where the id is a Date.
  + *
  + * @version $Id: DateKey.java,v 1.6 2002/04/30 09:22:38 mpoeschl Exp $
    */
   public class DateKey extends SimpleKey
   {
  @@ -112,9 +113,13 @@
       public void setValue(DateKey key)
       {
           if (key != null)
  +        {
               this.key = key.getValue();
  +        }
           else
  +        {
               this.key = null;
  +        }
       }
   
       /**
  @@ -124,7 +129,7 @@
        */
       public Date getDate()
       {
  -        return (Date)key;
  +        return (Date) key;
       }
   
       /**
  @@ -146,13 +151,19 @@
               // internal keys equivalent.
               else if ( keyObj instanceof DateKey)
               {
  -                Object obj = ((DateKey)keyObj).getValue();
  +                Object obj = ((DateKey) keyObj).getValue();
                   isEqual =  key.equals(obj);
               }
           }
           return isEqual;
       }
   
  +    /**
  +     * get a String representation
  +     *
  +     * @return a String representation of the Date or an empty String if the
  +     *          Date is null
  +     */
       public String toString()
       {
           Date dt = getDate();
  
  
  
  1.5       +5 -4      
jakarta-turbine-torque/src/java/org/apache/torque/om/NumberKey.java
  
  Index: NumberKey.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/om/NumberKey.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NumberKey.java    2 Oct 2001 16:45:09 -0000       1.4
  +++ NumberKey.java    30 Apr 2002 09:22:38 -0000      1.5
  @@ -55,12 +55,13 @@
    */
   
   import java.math.BigDecimal;
  -import org.apache.torque.TorqueException;
   
   /**
    * This class can be used as an ObjectKey to uniquely identify an
    * object within an application where the id  consists
    * of a single entity such a GUID or the value of a db row's primary key.
  + *
  + * @version $Id: NumberKey.java,v 1.5 2002/04/30 09:22:38 mpoeschl Exp $
    */
   public class NumberKey extends SimpleKey
   {
  @@ -146,7 +147,7 @@
        */
       public BigDecimal getBigDecimal()
       {
  -        return (BigDecimal)key;
  +        return (BigDecimal) key;
       }
   
       /**
  @@ -166,9 +167,9 @@
               }
               // check against a NumberKey. Two keys are equal, if their
               // internal keys equivalent.
  -            else if ( keyObj instanceof NumberKey  )
  +            else if (keyObj instanceof NumberKey)
               {
  -                Object obj = ((NumberKey)keyObj).getValue();
  +                Object obj = ((NumberKey) keyObj).getValue();
                   isEqual =  key.equals(obj);
               }
           }
  
  
  
  1.4       +2 -0      
jakarta-turbine-torque/src/java/org/apache/torque/om/ObjectKey.java
  
  Index: ObjectKey.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/om/ObjectKey.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ObjectKey.java    31 Jan 2002 16:24:30 -0000      1.3
  +++ ObjectKey.java    30 Apr 2002 09:22:38 -0000      1.4
  @@ -62,6 +62,8 @@
    * an application.  There are four subclasses: StringKey, NumberKey,
    * and DateKey, and ComboKey which is a Key made up of a combination
    * ofthe first three.
  + *
  + * @version $Id: ObjectKey.java,v 1.4 2002/04/30 09:22:38 mpoeschl Exp $
    */
   public abstract class ObjectKey implements Serializable, Comparable
   {
  
  
  
  1.9       +4 -4      
jakarta-turbine-torque/src/java/org/apache/torque/om/Persistent.java
  
  Index: Persistent.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/om/Persistent.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Persistent.java   28 Oct 2001 19:46:02 -0000      1.8
  +++ Persistent.java   30 Apr 2002 09:22:38 -0000      1.9
  @@ -61,7 +61,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>John D. McNally</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Fedor K.</a>
  - * @version $Id: Persistent.java,v 1.8 2001/10/28 19:46:02 jmcnally Exp $
  + * @version $Id: Persistent.java,v 1.9 2002/04/30 09:22:38 mpoeschl Exp $
    */
   public interface Persistent
   {
  @@ -75,7 +75,7 @@
       /**
        * Sets the PrimaryKey for the object.
        *
  -     * @param ObjectKey The new PrimaryKey for the object.
  +     * @param primaryKey The new PrimaryKey for the object.
        * @exception Exception, This method might throw an exceptions
        */
       void setPrimaryKey(ObjectKey primaryKey) throws Exception;
  @@ -83,7 +83,7 @@
       /**
        * Sets the PrimaryKey for the object.
        *
  -     * @param String, the String should be of the form produced by
  +     * @param primaryKey the String should be of the form produced by
        *        ObjectKey.toString().
        * @exception Exception, This method might throw an exceptions
        */
  @@ -110,7 +110,7 @@
        * Setter for the isNew attribute.  This method will be called
        * by Torque-generated children and Peers.
        *
  -     * @param b, the state of the object.
  +     * @param b the state of the object.
        */
       void setNew(boolean b);
   
  
  
  
  1.4       +12 -4     
jakarta-turbine-torque/src/java/org/apache/torque/om/StringKey.java
  
  Index: StringKey.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/om/StringKey.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StringKey.java    20 Aug 2001 03:51:55 -0000      1.3
  +++ StringKey.java    30 Apr 2002 09:22:38 -0000      1.4
  @@ -54,12 +54,13 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.torque.TorqueException;
   
   /**
    * This class can be used as an ObjectKey to uniquely identify an
    * object within an application where the id  consists
    * of a single entity such a GUID or the value of a db row's primary key.
  + *
  + * @version $Id: StringKey.java,v 1.4 2002/04/30 09:22:38 mpoeschl Exp $
    */
   public class StringKey extends SimpleKey
   {
  @@ -102,9 +103,13 @@
       public void setValue(StringKey key)
       {
           if (key != null)
  +        {
               this.key = key.getValue();
  +        }
           else
  +        {
               this.key = null;
  +        }
       }
   
       /**
  @@ -114,7 +119,7 @@
        */
       public String getString()
       {
  -        return (String)key;
  +        return (String) key;
       }
   
       /**
  @@ -136,18 +141,21 @@
               // internal keys equivalent.
               else if ( keyObj instanceof StringKey)
               {
  -                Object obj = ((StringKey)keyObj).getValue();
  +                Object obj = ((StringKey) keyObj).getValue();
                   isEqual =  key.equals(obj);
               }
           }
           return isEqual;
       }
   
  +    /**
  +     *
  +     */
       public String toString()
       {
           if ( key != null )
           {
  -            return (String)key;
  +            return (String) key;
           }
           return "";
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to