Coverage Report - org.apache.commons.classscan.bcel.AnnotationMap
 
Classes in this File Line Coverage Branch Coverage Complexity
AnnotationMap
100%
10/10
100%
6/6
2.333
 
 1  
 /*
 2  
  * Licensed under the Apache License, Version 2.0 (the "License");
 3  
  * you may not use this file except in compliance with the License.
 4  
  * You may obtain a copy of the License at
 5  
  *
 6  
  *      http://www.apache.org/licenses/LICENSE-2.0
 7  
  *
 8  
  * Unless required by applicable law or agreed to in writing, software
 9  
  * distributed under the License is distributed on an "AS IS" BASIS,
 10  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 11  
  * See the License for the specific language governing permissions and
 12  
  * limitations under the License.
 13  
  */
 14  
 package org.apache.commons.classscan.bcel;
 15  
 
 16  
 import org.apache.bcel.classfile.AnnotationEntry;
 17  
 import org.apache.commons.classscan.util.NameSet;
 18  
 
 19  
 public class AnnotationMap extends NameSet<BcelAnnotation> {
 20  
 
 21  11
         private static AnnotationMap EMPTY_ANNOTATIONS= new AnnotationMap(new AnnotationEntry[0]);
 22  
         
 23  
         public static AnnotationMap createAnnotations(AnnotationEntry[] annotationEntries) {
 24  5195619
         if(annotationEntries==null || annotationEntries.length==0) {
 25  5165248
                 return EMPTY_ANNOTATIONS;
 26  
         }
 27  30371
                 return new AnnotationMap(annotationEntries);
 28  
         }
 29  
         
 30  
     private AnnotationMap(AnnotationEntry[] entries) {
 31  30382
         super(transformEntries(entries));
 32  30382
     }
 33  
 
 34  
     static private BcelAnnotation[] transformEntries(AnnotationEntry[] entries) {
 35  
                     
 36  30382
             BcelAnnotation[] annotations = new BcelAnnotation[entries.length];
 37  62810
         for(int i = 0; i<entries.length; ++i) {
 38  32428
                 annotations[i]= new BcelAnnotation(entries[i]);
 39  
         }
 40  30382
         return annotations;
 41  
     }
 42  
 }