Coverage Report - org.apache.maven.jxr.pacman.JavaFile
 
Classes in this File Line Coverage Branch Coverage Complexity
JavaFile
100%
26/26
N/A
1,167
 
 1  
 package org.apache.maven.jxr.pacman;
 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 java.util.ArrayList;
 23  
 import java.util.List;
 24  
 import java.util.Vector;
 25  
 
 26  
 /**
 27  
  * Interface for objects which wish to provide metainfo about a JavaFile.
 28  
  *
 29  
  * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
 30  
  * @version $Id: JavaFile.java 514409 2007-03-04 15:31:15Z dennisl $
 31  
  */
 32  8
 public abstract class JavaFile
 33  
 {
 34  
 
 35  8
     private Vector imports = new Vector();
 36  
 
 37  8
     private ArrayList classTypes = new ArrayList();
 38  
 
 39  8
     private PackageType packageType = new PackageType();
 40  
 
 41  8
     private String filename = null;
 42  
 
 43  8
     private String encoding = null;
 44  
 
 45  
     /**
 46  
      * Get the imported packages/files that this package has.
 47  
      */
 48  
     public ImportType[] getImportTypes()
 49  
     {
 50  
 
 51  241
         ImportType[] it = new ImportType[this.imports.size()];
 52  241
         this.imports.copyInto( it );
 53  241
         return it;
 54  
     }
 55  
 
 56  
     /**
 57  
      * Get the name of this class.
 58  
      */
 59  
     public ClassType getClassType()
 60  
     {
 61  38
         if ( classTypes.isEmpty() )
 62  
         {
 63  2
             return null;
 64  
         }
 65  
         else
 66  
         {
 67  
             // To retain backward compatibility, return the first class
 68  36
             return (ClassType) this.classTypes.get( 0 );
 69  
         }
 70  
     }
 71  
 
 72  
     /**
 73  
      * Get the names of the classes in this file.
 74  
      */
 75  
     public List getClassTypes()
 76  
     {
 77  17
         return this.classTypes;
 78  
     }
 79  
 
 80  
     /**
 81  
      * Get the package of this class.
 82  
      */
 83  
     public PackageType getPackageType()
 84  
     {
 85  270
         return this.packageType;
 86  
     }
 87  
 
 88  
 
 89  
     /**
 90  
      * Add a ClassType to the current list of class types.
 91  
      */
 92  
     public void addClassType( ClassType classType )
 93  
     {
 94  6
         this.classTypes.add( classType );
 95  6
     }
 96  
 
 97  
     /**
 98  
      * Add an ImportType to the current imports.
 99  
      */
 100  
     public void addImportType( ImportType importType )
 101  
     {
 102  24
         this.imports.addElement( importType );
 103  24
     }
 104  
 
 105  
     /**
 106  
      * Set the name of this class.
 107  
      */
 108  
     public void setClassType( ClassType classType )
 109  
     {
 110  
         // To retain backward compatibility, make sure the list contains only the supplied classType
 111  
         this.classTypes.clear();
 112  
         this.classTypes.add( classType );
 113  
     }
 114  
 
 115  
     /**
 116  
      * Set the PackageType of this class.
 117  
      */
 118  
     public void setPackageType( PackageType packageType )
 119  
     {
 120  7
         this.packageType = packageType;
 121  7
     }
 122  
 
 123  
 
 124  
     /**
 125  
      * Gets the filename attribute of the JavaFile object
 126  
      */
 127  
     public String getFilename()
 128  
     {
 129  30
         return this.filename;
 130  
     }
 131  
 
 132  
     /**
 133  
      * Sets the filename attribute of the JavaFile object
 134  
      */
 135  
     public void setFilename( String filename )
 136  
     {
 137  8
         this.filename = filename;
 138  8
     }
 139  
 
 140  
 
 141  
     /**
 142  
      * Gets the encoding attribute of the JavaFile object
 143  
      */
 144  
     public String getEncoding()
 145  
     {
 146  14
         return this.encoding;
 147  
     }
 148  
 
 149  
     /**
 150  
      * Sets the encoding attribute of the JavaFile object
 151  
      */
 152  
     public void setEncoding( String encoding )
 153  
     {
 154  8
         this.encoding = encoding;
 155  8
     }
 156  
 }