added InstanciationStrategy enumeration

git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1337592 13f79535-47bb-0310-9956-ffa450edef68
master
Herve Boutemy 2012-05-12 17:07:01 +00:00
parent c9063cbb83
commit 360a9d2e8e
4 changed files with 51 additions and 5 deletions

View File

@ -0,0 +1,44 @@
package org.apache.maven.plugins.annotations;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* @author Hervé Boutemy
* @since 3.0
*/
public enum InstanciationStrategy
{
PER_LOOKUP( "per-lookup" ),
SINGLETON( "singleton" ),
KEEP_ALIVE( "keep-alive" ),
POOLABLE( "poolable" );
private final String id;
InstanciationStrategy( String id )
{
this.id = id;
}
public String id()
{
return this.id;
}
}

View File

@ -44,7 +44,7 @@ public @interface Mojo
DependencyScope requiresDependencyCollection() default DependencyScope.RUNTIME; DependencyScope requiresDependencyCollection() default DependencyScope.RUNTIME;
String instantiationStrategy() default "per-lookup"; InstanciationStrategy instantiationStrategy() default InstanciationStrategy.PER_LOOKUP;
String executionStrategy() default "once-per-session"; String executionStrategy() default "once-per-session";

View File

@ -20,6 +20,7 @@ package org.apache.maven.tools.plugin.annotations.datamodel;
*/ */
import org.apache.maven.plugins.annotations.DependencyScope; import org.apache.maven.plugins.annotations.DependencyScope;
import org.apache.maven.plugins.annotations.InstanciationStrategy;
import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Mojo;
@ -41,7 +42,7 @@ public class MojoAnnotationContent
private DependencyScope requiresDependencyCollection = DependencyScope.RUNTIME; private DependencyScope requiresDependencyCollection = DependencyScope.RUNTIME;
private String instantiationStrategy = "per-lookup"; private InstanciationStrategy instantiationStrategy = InstanciationStrategy.PER_LOOKUP;
private String executionStrategy = "once-per-session"; private String executionStrategy = "once-per-session";
@ -96,12 +97,12 @@ public class MojoAnnotationContent
this.requiresDependencyCollection = requiresDependencyCollection; this.requiresDependencyCollection = requiresDependencyCollection;
} }
public String instantiationStrategy() public InstanciationStrategy instantiationStrategy()
{ {
return instantiationStrategy; return instantiationStrategy;
} }
public void instantiationStrategy( String instantiationStrategy ) public void instantiationStrategy( InstanciationStrategy instantiationStrategy )
{ {
this.instantiationStrategy = instantiationStrategy; this.instantiationStrategy = instantiationStrategy;
} }

View File

@ -39,6 +39,7 @@ import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugins.annotations.DependencyScope; import org.apache.maven.plugins.annotations.DependencyScope;
import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.InstanciationStrategy;
import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.Parameter;
@ -53,7 +54,7 @@ import org.apache.maven.plugins.annotations.Parameter;
configurator = "<roleHint>", configurator = "<roleHint>",
executionStrategy = "<once-per-session|always>", executionStrategy = "<once-per-session|always>",
inheritByDefault = <true|false>, inheritByDefault = <true|false>,
instantiationStrategy = "<per-lookup|singleton|keep-alive|poolable>", instantiationStrategy = InstanciationStrategy.<strategy>,
defaultPhase = "<phaseName>", defaultPhase = "<phaseName>",
requiresDependencyResolution = DependencyScope.<scope>, requiresDependencyResolution = DependencyScope.<scope>,
requiresDependencyCollection = DependencyScope.<scope>, // (since Maven 3.0) requiresDependencyCollection = DependencyScope.<scope>, // (since Maven 3.0)