Coverage Report - org.apache.maven.jxr.pacman.ImportType
 
Classes in this File Line Coverage Branch Coverage Complexity
ImportType
100%
12/12
N/A
1,25
 
 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  
 /**
 23  
  * Represents an entry in a java "import" statement
 24  
  */
 25  
 public class ImportType
 26  
     extends BaseType
 27  
 {
 28  
 
 29  24
     private boolean isclass = false;
 30  
 
 31  24
     private boolean ispackage = false;
 32  
 
 33  24
     private String packagename = null;
 34  
 
 35  
     /**
 36  
      * Create a new ImportType with the specified name
 37  
      *
 38  
      * @param name
 39  
      */
 40  
     public ImportType( String name )
 41  24
     {
 42  24
         this.setName( name );
 43  
 
 44  
         //compute member variables
 45  
 
 46  24
         this.isclass = this.getName().indexOf( "*" ) == -1;
 47  
 
 48  24
         this.ispackage = this.getName().indexOf( "*" ) != -1;
 49  
 
 50  24
         int end = this.getName().lastIndexOf( "." );
 51  24
         if ( end != -1 )
 52  
         {
 53  24
             this.packagename = this.getName().substring( 0, end );
 54  
         }
 55  
 
 56  24
     }
 57  
 
 58  
     /**
 59  
      * Return true if this is a class import. Ex: test.Test
 60  
      */
 61  
     public boolean isClass()
 62  
     {
 63  
         return this.isclass;
 64  
     }
 65  
 
 66  
     /**
 67  
      * Return true if this is a package import. Ex: test.*
 68  
      */
 69  
     public boolean isPackage()
 70  
     {
 71  
         return this.ispackage;
 72  
     }
 73  
 
 74  
 
 75  
     /**
 76  
      * Get the name of the package that this import is based on: EX: test.* will
 77  
      * return "test" EX: test.Test will return "test"
 78  
      */
 79  
     public String getPackage()
 80  
     {
 81  1100
         return this.packagename;
 82  
     }
 83  
 
 84  
 }
 85