Coverage Report - org.apache.torque.engine.database.model.IdMethodParameter
 
Classes in this File Line Coverage Branch Coverage Complexity
IdMethodParameter
0%
0/20
0%
0/2
1.111
 
 1  
 package org.apache.torque.engine.database.model;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.xml.sax.Attributes;
 23  
 
 24  
 /**
 25  
  * Information related to an ID method.
 26  
  *
 27  
  * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
 28  
  * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
 29  
  * @version $Id: IdMethodParameter.java,v 1.1 2007-10-21 07:57:27 abyrne Exp $
 30  
  */
 31  0
 public class IdMethodParameter
 32  
 {
 33  
     private String name;
 34  
     private String value;
 35  
     private Table parentTable;
 36  
 
 37  
     /**
 38  
      * Imports foreign key from an XML specification
 39  
      */
 40  
     public void loadFromXML (Attributes attrib)
 41  
     {
 42  0
         name = attrib.getValue("name");
 43  0
         value = attrib.getValue("value");
 44  0
     }
 45  
 
 46  
     /**
 47  
      * Get the parameter name
 48  
      */
 49  
     public String getName()
 50  
     {
 51  0
         return name;
 52  
     }
 53  
 
 54  
     /**
 55  
      * Set the parameter name
 56  
      */
 57  
     public void setName(String name)
 58  
     {
 59  0
         this.name = name;
 60  0
     }
 61  
 
 62  
     /**
 63  
      * Get the parameter value
 64  
      */
 65  
     public String getValue()
 66  
     {
 67  0
         return value;
 68  
     }
 69  
 
 70  
     /**
 71  
      * Set the parameter value
 72  
      */
 73  
     public void setValue(String value)
 74  
     {
 75  0
         this.value = value;
 76  0
     }
 77  
 
 78  
     /**
 79  
      * Set the parent Table of the id method
 80  
      */
 81  
     public void setTable(Table parent)
 82  
     {
 83  0
         parentTable = parent;
 84  0
     }
 85  
 
 86  
     /**
 87  
      * Get the parent Table of the id method
 88  
      */
 89  
     public Table getTable()
 90  
     {
 91  0
         return parentTable;
 92  
     }
 93  
 
 94  
     /**
 95  
      * Returns the Name of the table the id method is in
 96  
      */
 97  
     public String getTableName()
 98  
     {
 99  0
         return parentTable.getName();
 100  
     }
 101  
 
 102  
     /**
 103  
      * XML representation of the foreign key.
 104  
      */
 105  
     public String toString()
 106  
     {
 107  0
         StringBuffer result = new StringBuffer();
 108  0
         result.append(" <id-method-parameter");
 109  0
         if (getName() != null)
 110  
         {
 111  0
             result.append(" name=\"")
 112  
                   .append(getName())
 113  
                   .append("\"");
 114  
         }
 115  0
         result.append(" value=\"")
 116  
               .append(getValue())
 117  
               .append("\">\n");
 118  0
         return result.toString();
 119  
     }
 120  
 }