Coverage Report - org.apache.maven.tools.plugin.annotations.scanner.MojoAnnotatedClass
 
Classes in this File Line Coverage Branch Coverage Complexity
MojoAnnotatedClass
86 %
32/37
100 %
4/4
1,125
 
 1  
 package org.apache.maven.tools.plugin.annotations.scanner;
 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.apache.maven.artifact.Artifact;
 23  
 import org.apache.maven.tools.plugin.annotations.datamodel.ComponentAnnotationContent;
 24  
 import org.apache.maven.tools.plugin.annotations.datamodel.ExecuteAnnotationContent;
 25  
 import org.apache.maven.tools.plugin.annotations.datamodel.MojoAnnotationContent;
 26  
 import org.apache.maven.tools.plugin.annotations.datamodel.ParameterAnnotationContent;
 27  
 
 28  
 import java.util.HashMap;
 29  
 import java.util.Map;
 30  
 
 31  
 /**
 32  
  * @author Olivier Lamy
 33  
  * @since 3.0
 34  
  */
 35  
 public class MojoAnnotatedClass
 36  
 {
 37  
     private String className;
 38  
 
 39  
     private String parentClassName;
 40  
 
 41  
     private MojoAnnotationContent mojo;
 42  
 
 43  
     private ExecuteAnnotationContent execute;
 44  
 
 45  
     /**
 46  
      * key is field name
 47  
      */
 48  
     private Map<String, ParameterAnnotationContent> parameters;
 49  
 
 50  
     /**
 51  
      * key is field name
 52  
      */
 53  
     private Map<String, ComponentAnnotationContent> components;
 54  
 
 55  
     /**
 56  
      * artifact which contains this annotation
 57  
      */
 58  
     private Artifact artifact;
 59  
 
 60  
     public MojoAnnotatedClass()
 61  1
     {
 62  
         // no op
 63  1
     }
 64  
 
 65  
     public String getClassName()
 66  
     {
 67  3
         return className;
 68  
     }
 69  
 
 70  
     public MojoAnnotatedClass setClassName( String className )
 71  
     {
 72  1
         this.className = className;
 73  1
         return this;
 74  
     }
 75  
 
 76  
     public MojoAnnotationContent getMojo()
 77  
     {
 78  1
         return mojo;
 79  
     }
 80  
 
 81  
     public MojoAnnotatedClass setMojo( MojoAnnotationContent mojo )
 82  
     {
 83  1
         this.mojo = mojo;
 84  1
         return this;
 85  
     }
 86  
 
 87  
     public ExecuteAnnotationContent getExecute()
 88  
     {
 89  1
         return execute;
 90  
     }
 91  
 
 92  
     public MojoAnnotatedClass setExecute( ExecuteAnnotationContent execute )
 93  
     {
 94  1
         this.execute = execute;
 95  1
         return this;
 96  
     }
 97  
 
 98  
     public Map<String, ParameterAnnotationContent> getParameters()
 99  
     {
 100  3
         if ( this.parameters == null )
 101  
         {
 102  1
             this.parameters = new HashMap<String, ParameterAnnotationContent>();
 103  
         }
 104  3
         return parameters;
 105  
     }
 106  
 
 107  
     public MojoAnnotatedClass setParameters( Map<String, ParameterAnnotationContent> parameters )
 108  
     {
 109  0
         this.parameters = parameters;
 110  0
         return this;
 111  
     }
 112  
 
 113  
     public Map<String, ComponentAnnotationContent> getComponents()
 114  
     {
 115  3
         if ( this.components == null )
 116  
         {
 117  1
             this.components = new HashMap<String, ComponentAnnotationContent>();
 118  
         }
 119  3
         return components;
 120  
     }
 121  
 
 122  
     public MojoAnnotatedClass setComponents( Map<String, ComponentAnnotationContent> components )
 123  
     {
 124  0
         this.components = components;
 125  0
         return this;
 126  
     }
 127  
 
 128  
     public String getParentClassName()
 129  
     {
 130  1
         return parentClassName;
 131  
     }
 132  
 
 133  
     public MojoAnnotatedClass setParentClassName( String parentClassName )
 134  
     {
 135  1
         this.parentClassName = parentClassName;
 136  1
         return this;
 137  
     }
 138  
 
 139  
     public Artifact getArtifact()
 140  
     {
 141  0
         return artifact;
 142  
     }
 143  
 
 144  
     public void setArtifact( Artifact artifact )
 145  
     {
 146  1
         this.artifact = artifact;
 147  1
     }
 148  
 
 149  
     @Override
 150  
     public String toString()
 151  
     {
 152  2
         final StringBuilder sb = new StringBuilder();
 153  2
         sb.append( "MojoAnnotatedClass" );
 154  2
         sb.append( "{className='" ).append( className ).append( '\'' );
 155  2
         sb.append( ", parentClassName='" ).append( parentClassName ).append( '\'' );
 156  2
         sb.append( ", mojo=" ).append( mojo );
 157  2
         sb.append( ", execute=" ).append( execute );
 158  2
         sb.append( ", parameters=" ).append( parameters );
 159  2
         sb.append( ", components=" ).append( components );
 160  2
         sb.append( '}' );
 161  2
         return sb.toString();
 162  
     }
 163  
 }