Coverage Report - org.apache.maven.tools.plugin.annotations.datamodel.MojoAnnotationContent
 
Classes in this File Line Coverage Branch Coverage Complexity
MojoAnnotationContent
53%
41/77
0%
0/2
1.065
 
 1  
 package org.apache.maven.tools.plugin.annotations.datamodel;
 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.plugins.annotations.InstantiationStrategy;
 23  
 import org.apache.maven.plugins.annotations.InstanciationStrategy;
 24  
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 25  
 import org.apache.maven.plugins.annotations.Mojo;
 26  
 import org.apache.maven.plugins.annotations.ResolutionScope;
 27  
 
 28  
 import java.lang.annotation.Annotation;
 29  
 
 30  
 /**
 31  
  * @author Olivier Lamy
 32  
  * @since 3.0
 33  
  */
 34  
 @SuppressWarnings("deprecation")
 35  1
 public class MojoAnnotationContent
 36  
     extends AnnotatedContent
 37  
     implements Mojo
 38  
 {
 39  
     private String name;
 40  
 
 41  1
     private LifecyclePhase defaultPhase = LifecyclePhase.NONE;
 42  
 
 43  1
     private ResolutionScope requiresDependencyResolution = ResolutionScope.NONE;
 44  
 
 45  1
     private ResolutionScope requiresDependencyCollection = ResolutionScope.NONE;
 46  
 
 47  1
     private InstantiationStrategy instantiationStrategy = InstantiationStrategy.PER_LOOKUP;
 48  
 
 49  1
     private String executionStrategy = "once-per-session";
 50  
 
 51  1
     private boolean requiresProject = true;
 52  
 
 53  1
     private boolean requiresReports = false;
 54  
 
 55  1
     private boolean aggregator = false;
 56  
 
 57  1
     private boolean requiresDirectInvocation = false;
 58  
 
 59  1
     private boolean requiresOnline = false;
 60  
 
 61  1
     private boolean inheritByDefault = true;
 62  
 
 63  
     private String configurator;
 64  
 
 65  1
     private boolean threadSafe = false;
 66  
 
 67  
     public Class<? extends Annotation> annotationType()
 68  
     {
 69  0
         return null;
 70  
     }
 71  
 
 72  
     public LifecyclePhase defaultPhase()
 73  
     {
 74  1
         return defaultPhase;
 75  
     }
 76  
 
 77  
     public void defaultPhase( String phase )
 78  
     {
 79  1
         this.defaultPhase = LifecyclePhase.valueOf( phase );
 80  1
     }
 81  
 
 82  
     public ResolutionScope requiresDependencyResolution()
 83  
     {
 84  0
         return requiresDependencyResolution;
 85  
     }
 86  
 
 87  
     public void requiresDependencyResolution( String requiresDependencyResolution )
 88  
     {
 89  0
         this.requiresDependencyResolution = ResolutionScope.valueOf( requiresDependencyResolution );
 90  0
     }
 91  
 
 92  
     public ResolutionScope requiresDependencyCollection()
 93  
     {
 94  0
         return requiresDependencyCollection;
 95  
     }
 96  
 
 97  
     public void requiresDependencyCollection( String requiresDependencyCollection )
 98  
     {
 99  0
         this.requiresDependencyCollection = ResolutionScope.valueOf( requiresDependencyCollection );
 100  0
     }
 101  
 
 102  
     public InstantiationStrategy instantiationStrategy()
 103  
     {
 104  0
         return instantiationStrategy;
 105  
     }
 106  
 
 107  
     /**
 108  
      * The original spelling of the instantiationStrategy attribute.
 109  
      * This returns the value under the correct name, there's no separate
 110  
      * field.
 111  
      *
 112  
      * @return the instantiation strategy
 113  
      * @see #instantiationStrategy()
 114  
      */
 115  
     @SuppressWarnings( "deprecation" )
 116  
     public InstanciationStrategy instanciationStrategy()
 117  
     {
 118  0
         if ( instantiationStrategy == null )
 119  
         {
 120  0
             return null;
 121  
         }
 122  0
         return InstanciationStrategy.valueOf( instanciationStrategy().name() );
 123  
     }
 124  
 
 125  
     public void instantiationStrategy( String instantiationStrategy )
 126  
     {
 127  0
         this.instantiationStrategy = InstantiationStrategy.valueOf( instantiationStrategy );
 128  0
     }
 129  
 
 130  
     public String executionStrategy()
 131  
     {
 132  0
         return executionStrategy;
 133  
     }
 134  
 
 135  
     public void executionStrategy( String executionStrategy )
 136  
     {
 137  0
         this.executionStrategy = executionStrategy;
 138  0
     }
 139  
 
 140  
     public boolean requiresProject()
 141  
     {
 142  0
         return requiresProject;
 143  
     }
 144  
 
 145  
     public void requiresProject( boolean requiresProject )
 146  
     {
 147  0
         this.requiresProject = requiresProject;
 148  0
     }
 149  
 
 150  
     public boolean requiresReports()
 151  
     {
 152  0
         return requiresReports;
 153  
     }
 154  
 
 155  
     public void requiresReports( boolean requiresReports )
 156  
     {
 157  0
         this.requiresReports = requiresReports;
 158  0
     }
 159  
 
 160  
     public boolean aggregator()
 161  
     {
 162  1
         return aggregator;
 163  
     }
 164  
 
 165  
     public void aggregator( boolean aggregator )
 166  
     {
 167  0
         this.aggregator = aggregator;
 168  0
     }
 169  
 
 170  
     public boolean requiresDirectInvocation()
 171  
     {
 172  0
         return requiresDirectInvocation;
 173  
     }
 174  
 
 175  
     public void requiresDirectInvocation( boolean requiresDirectInvocation )
 176  
     {
 177  0
         this.requiresDirectInvocation = requiresDirectInvocation;
 178  0
     }
 179  
 
 180  
     public boolean requiresOnline()
 181  
     {
 182  0
         return requiresOnline;
 183  
     }
 184  
 
 185  
     public void requiresOnline( boolean requiresOnline )
 186  
     {
 187  0
         this.requiresOnline = requiresOnline;
 188  0
     }
 189  
 
 190  
     public boolean inheritByDefault()
 191  
     {
 192  0
         return inheritByDefault;
 193  
     }
 194  
 
 195  
     public void inheritByDefault( boolean inheritByDefault )
 196  
     {
 197  0
         this.inheritByDefault = inheritByDefault;
 198  0
     }
 199  
 
 200  
     public String configurator()
 201  
     {
 202  0
         return configurator;
 203  
     }
 204  
 
 205  
     public void configurator( String configurator )
 206  
     {
 207  0
         this.configurator = configurator;
 208  0
     }
 209  
 
 210  
     public boolean threadSafe()
 211  
     {
 212  1
         return threadSafe;
 213  
     }
 214  
 
 215  
     public void threadSafe( boolean threadSafe )
 216  
     {
 217  1
         this.threadSafe = threadSafe;
 218  1
     }
 219  
 
 220  
     public String name()
 221  
     {
 222  1
         return this.name;
 223  
     }
 224  
 
 225  
     public void name( String name )
 226  
     {
 227  1
         this.name = name;
 228  1
     }
 229  
 
 230  
     @Override
 231  
     public String toString()
 232  
     {
 233  2
         final StringBuilder sb = new StringBuilder();
 234  2
         sb.append( "MojoAnnotationContent" );
 235  2
         sb.append( "{name='" ).append( name ).append( '\'' );
 236  2
         sb.append( ", defaultPhase=" ).append( defaultPhase );
 237  2
         sb.append( ", requiresDependencyResolution='" ).append( requiresDependencyResolution ).append( '\'' );
 238  2
         sb.append( ", requiresDependencyCollection='" ).append( requiresDependencyCollection ).append( '\'' );
 239  2
         sb.append( ", instantiationStrategy='" ).append( instantiationStrategy ).append( '\'' );
 240  2
         sb.append( ", executionStrategy='" ).append( executionStrategy ).append( '\'' );
 241  2
         sb.append( ", requiresProject=" ).append( requiresProject );
 242  2
         sb.append( ", requiresReports=" ).append( requiresReports );
 243  2
         sb.append( ", aggregator=" ).append( aggregator );
 244  2
         sb.append( ", requiresDirectInvocation=" ).append( requiresDirectInvocation );
 245  2
         sb.append( ", requiresOnline=" ).append( requiresOnline );
 246  2
         sb.append( ", inheritByDefault=" ).append( inheritByDefault );
 247  2
         sb.append( ", configurator='" ).append( configurator ).append( '\'' );
 248  2
         sb.append( ", threadSafe=" ).append( threadSafe );
 249  2
         sb.append( '}' );
 250  2
         return sb.toString();
 251  
     }
 252  
 }