Coverage Report - org.apache.maven.shared.jar.identification.JarIdentification
 
Classes in this File Line Coverage Branch Coverage Complexity
JarIdentification
0%
0/60
0%
0/14
1.269
 
 1  
 package org.apache.maven.shared.jar.identification;
 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  
 
 25  
 /**
 26  
  * Gathered Maven information about the JAR file. Stores both assumed/validated values and potential values.
 27  
  *
 28  
  * @see org.apache.maven.shared.jar.identification.JarIdentificationAnalysis#analyze(org.apache.maven.shared.jar.JarAnalyzer)
 29  
  */
 30  0
 public class JarIdentification
 31  
 {
 32  
     /**
 33  
      * The group ID derived or guessed from the list of potentials of the JAR.
 34  
      */
 35  
     private String groupId;
 36  
 
 37  
     /**
 38  
      * The artifact ID derived or guessed from the list of potentials of the JAR.
 39  
      */
 40  
     private String artifactId;
 41  
 
 42  
     /**
 43  
      * The version derived or guessed from the list of potentials of the JAR.
 44  
      */
 45  
     private String version;
 46  
 
 47  
     /**
 48  
      * The project name derived or guessed from the list of potentials of the JAR.
 49  
      */
 50  
     private String name;
 51  
 
 52  
     /**
 53  
      * The vendor (organization name) derived or guessed from the list of potentials of the JAR.
 54  
      */
 55  
     private String vendor;
 56  
 
 57  
     /**
 58  
      * The list of possible group IDs discovered.
 59  
      */
 60  0
     private List potentialGroupIds = new ArrayList();
 61  
 
 62  
     /**
 63  
      * The list of possible artifact IDs discovered.
 64  
      */
 65  0
     private List potentialArtifactIds = new ArrayList();
 66  
 
 67  
     /**
 68  
      * The list of possible versions discovered.
 69  
      */
 70  0
     private List potentialVersions = new ArrayList();
 71  
 
 72  
     /**
 73  
      * The list of possible artifact names discovered.
 74  
      */
 75  0
     private List potentialNames = new ArrayList();
 76  
 
 77  
     /**
 78  
      * The list of possible vendors discovered.
 79  
      */
 80  0
     private List potentialVendors = new ArrayList();
 81  
 
 82  
     /**
 83  
      * Add a validated group ID.
 84  
      *
 85  
      * @param groupId the group ID discovered
 86  
      */
 87  
     public void addAndSetGroupId( String groupId )
 88  
     {
 89  0
         if ( groupId != null )
 90  
         {
 91  0
             this.groupId = groupId;
 92  
         }
 93  
 
 94  0
         addGroupId( groupId );
 95  0
     }
 96  
 
 97  
     /**
 98  
      * Add a potential group ID.
 99  
      *
 100  
      * @param groupId the group ID discovered
 101  
      */
 102  
     public void addGroupId( String groupId )
 103  
     {
 104  0
         addUnique( potentialGroupIds, groupId );
 105  0
     }
 106  
 
 107  
     /**
 108  
      * Add a validated artifact ID.
 109  
      *
 110  
      * @param artifactId the artifact ID discovered
 111  
      */
 112  
     public void addAndSetArtifactId( String artifactId )
 113  
     {
 114  0
         if ( artifactId != null )
 115  
         {
 116  0
             this.artifactId = artifactId;
 117  
         }
 118  
 
 119  0
         addArtifactId( artifactId );
 120  0
     }
 121  
 
 122  
     /**
 123  
      * Add a potential artifact ID.
 124  
      *
 125  
      * @param artifactId the artifact ID discovered
 126  
      */
 127  
     public void addArtifactId( String artifactId )
 128  
     {
 129  0
         addUnique( potentialArtifactIds, artifactId );
 130  0
     }
 131  
 
 132  
     /**
 133  
      * Add a validated version.
 134  
      *
 135  
      * @param version the version discovered
 136  
      */
 137  
     public void addAndSetVersion( String version )
 138  
     {
 139  0
         if ( version != null )
 140  
         {
 141  0
             this.version = version;
 142  
         }
 143  
 
 144  0
         addVersion( version );
 145  0
     }
 146  
 
 147  
     /**
 148  
      * Add a potential version.
 149  
      *
 150  
      * @param version the version discovered
 151  
      */
 152  
     public void addVersion( String version )
 153  
     {
 154  0
         addUnique( potentialVersions, version );
 155  0
     }
 156  
 
 157  
     /**
 158  
      * Add a validated vendor name.
 159  
      *
 160  
      * @param name the vendor name discovered
 161  
      */
 162  
     public void addAndSetVendor( String name )
 163  
     {
 164  0
         if ( name != null )
 165  
         {
 166  0
             vendor = name;
 167  
         }
 168  
 
 169  0
         addVendor( name );
 170  0
     }
 171  
 
 172  
     /**
 173  
      * Add a potential vendor name.
 174  
      *
 175  
      * @param name the vendor name discovered
 176  
      */
 177  
     public void addVendor( String name )
 178  
     {
 179  0
         addUnique( potentialVendors, name );
 180  0
     }
 181  
 
 182  
     /**
 183  
      * Add a validated artifact name.
 184  
      *
 185  
      * @param name the artifact name discovered
 186  
      */
 187  
     public void addAndSetName( String name )
 188  
     {
 189  0
         if ( name != null )
 190  
         {
 191  0
             this.name = name;
 192  
         }
 193  
 
 194  0
         addName( name );
 195  0
     }
 196  
 
 197  
     /**
 198  
      * Add a potential artifact name.
 199  
      *
 200  
      * @param name the artifact name discovered
 201  
      */
 202  
     public void addName( String name )
 203  
     {
 204  0
         addUnique( potentialNames, name );
 205  0
     }
 206  
 
 207  
     private static void addUnique( List list, String value )
 208  
     {
 209  0
         if ( value != null )
 210  
         {
 211  0
             if ( !list.contains( value ) )
 212  
             {
 213  0
                 list.add( value );
 214  
             }
 215  
         }
 216  0
     }
 217  
 
 218  
     public String getArtifactId()
 219  
     {
 220  0
         return artifactId;
 221  
     }
 222  
 
 223  
     public void setArtifactId( String artifactId )
 224  
     {
 225  0
         this.artifactId = artifactId;
 226  0
     }
 227  
 
 228  
     public String getGroupId()
 229  
     {
 230  0
         return groupId;
 231  
     }
 232  
 
 233  
     public void setGroupId( String groupId )
 234  
     {
 235  0
         this.groupId = groupId;
 236  0
     }
 237  
 
 238  
     public String getName()
 239  
     {
 240  0
         return name;
 241  
     }
 242  
 
 243  
     public void setName( String name )
 244  
     {
 245  0
         this.name = name;
 246  0
     }
 247  
 
 248  
     public String getVendor()
 249  
     {
 250  0
         return vendor;
 251  
     }
 252  
 
 253  
     public void setVendor( String vendor )
 254  
     {
 255  0
         this.vendor = vendor;
 256  0
     }
 257  
 
 258  
     public String getVersion()
 259  
     {
 260  0
         return version;
 261  
     }
 262  
 
 263  
     public void setVersion( String version )
 264  
     {
 265  0
         this.version = version;
 266  0
     }
 267  
 
 268  
     public List getPotentialVersions()
 269  
     {
 270  0
         return potentialVersions;
 271  
     }
 272  
 
 273  
     public List getPotentialNames()
 274  
     {
 275  0
         return potentialNames;
 276  
     }
 277  
 
 278  
     public List getPotentialGroupIds()
 279  
     {
 280  0
         return potentialGroupIds;
 281  
     }
 282  
 
 283  
     public List getPotentialArtifactIds()
 284  
     {
 285  0
         return potentialArtifactIds;
 286  
     }
 287  
 
 288  
     public List getPotentialVendors()
 289  
     {
 290  0
         return potentialVendors;
 291  
     }
 292  
 }