本文整理汇总了Java中org.codehaus.plexus.interpolation.ValueSource类的典型用法代码示例。如果您正苦于以下问题:Java ValueSource类的具体用法?Java ValueSource怎么用?Java ValueSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ValueSource类属于org.codehaus.plexus.interpolation包,在下文中一共展示了ValueSource类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: interpolate
import org.codehaus.plexus.interpolation.ValueSource; //导入依赖的package包/类
/**
* Interpolates all expressions in the src parameter.
* <p>
* The algorithm used for each expression is:
* <ul>
* <li>If it starts with either "pom." or "project.", the expression is evaluated against the model.</li>
* <li>If the value is null, get the value from the context.</li>
* <li>If the value is null, but the context contains the expression, don't replace the expression string
* with the value, and continue to find other expressions.</li>
* <li>If the value is null, get it from the model properties.</li>
* <li>
* @param overrideContext
* @param outputDebugMessages
*/
public String interpolate( String src,
Model model,
final File projectDir,
ProjectBuilderConfiguration config,
boolean debug )
throws ModelInterpolationException
{
try
{
List<ValueSource> valueSources = createValueSources( model, projectDir, config );
List<InterpolationPostProcessor> postProcessors = createPostProcessors( model, projectDir, config );
return interpolateInternal( src, valueSources, postProcessors, debug );
}
finally
{
interpolator.clearAnswers();
}
}
示例2: interpolateObject
import org.codehaus.plexus.interpolation.ValueSource; //导入依赖的package包/类
protected void interpolateObject( Object obj, Model model, File projectDir, ProjectBuilderConfiguration config,
boolean debugEnabled )
throws ModelInterpolationException
{
try
{
List<ValueSource> valueSources = createValueSources( model, projectDir, config );
List<InterpolationPostProcessor> postProcessors = createPostProcessors( model, projectDir, config );
InterpolateObjectAction action =
new InterpolateObjectAction( obj, valueSources, postProcessors, debugEnabled,
this, getLogger() );
ModelInterpolationException error = AccessController.doPrivileged( action );
if ( error != null )
{
throw error;
}
}
finally
{
getInterpolator().clearAnswers();
}
}
示例3: interpolateObject
import org.codehaus.plexus.interpolation.ValueSource; //导入依赖的package包/类
protected void interpolateObject( Object obj, Model model, File projectDir, ModelBuildingRequest config,
ModelProblemCollector problems )
{
try
{
List<? extends ValueSource> valueSources = createValueSources( model, projectDir, config, problems );
List<? extends InterpolationPostProcessor> postProcessors =
createPostProcessors( model, projectDir, config );
InterpolateObjectAction action =
new InterpolateObjectAction( obj, valueSources, postProcessors, this, problems );
AccessController.doPrivileged( action );
}
finally
{
getInterpolator().clearAnswers();
}
}
示例4: createValueSources
import org.codehaus.plexus.interpolation.ValueSource; //导入依赖的package包/类
@Override
protected List<ValueSource> createValueSources(Model model,
File projectDir,
ModelBuildingRequest config,
ModelProblemCollector problems) {
List<ValueSource> res = super.createValueSources(model, projectDir, config, problems);
if (localRepository != null) {
res.add(new SingleResponseValueSource("settings.localRepository", localRepository));
}
return res;
}
示例5: InterpolateObjectAction
import org.codehaus.plexus.interpolation.ValueSource; //导入依赖的package包/类
public InterpolateObjectAction( Object target, List<ValueSource> valueSources,
List<InterpolationPostProcessor> postProcessors, boolean debugEnabled,
StringSearchModelInterpolator modelInterpolator, Logger logger )
{
this.valueSources = valueSources;
this.postProcessors = postProcessors;
this.debugEnabled = debugEnabled;
this.interpolationTargets = new LinkedList<Object>();
interpolationTargets.add( target );
this.modelInterpolator = modelInterpolator;
this.logger = logger;
}
示例6: ProblemDetectingValueSource
import org.codehaus.plexus.interpolation.ValueSource; //导入依赖的package包/类
public ProblemDetectingValueSource( ValueSource valueSource, String bannedPrefix, String newPrefix,
ModelProblemCollector problems )
{
this.valueSource = valueSource;
this.bannedPrefix = bannedPrefix;
this.newPrefix = newPrefix;
this.problems = problems;
}
示例7: InterpolateObjectAction
import org.codehaus.plexus.interpolation.ValueSource; //导入依赖的package包/类
public InterpolateObjectAction( Object target, List<? extends ValueSource> valueSources,
List<? extends InterpolationPostProcessor> postProcessors,
StringSearchModelInterpolator modelInterpolator,
ModelProblemCollector problems )
{
this.valueSources = valueSources;
this.postProcessors = postProcessors;
this.interpolationTargets = new LinkedList<Object>();
interpolationTargets.add( target );
this.modelInterpolator = modelInterpolator;
this.problems = problems;
}
示例8: computePath
import org.codehaus.plexus.interpolation.ValueSource; //导入依赖的package包/类
private static Path computePath(Artifact artifact, ManifestConfiguration config) throws MojoExecutionException {
String layoutType = config.getClasspathLayoutType();
String layout = config.getCustomClasspathLayout();
Interpolator interpolator = new StringSearchInterpolator();
List<ValueSource> valueSources = new ArrayList<>();
valueSources.add(new PrefixedObjectValueSource(ARTIFACT_EXPRESSION_PREFIXES, artifact, true));
valueSources.add(new PrefixedObjectValueSource(ARTIFACT_EXPRESSION_PREFIXES, artifact.getArtifactHandler(), true));
Properties extraExpressions = new Properties();
if (!artifact.isSnapshot()) {
extraExpressions.setProperty("baseVersion", artifact.getVersion());
}
extraExpressions.setProperty("groupIdPath", artifact.getGroupId().replace('.', '/'));
if (artifact.hasClassifier()) {
extraExpressions.setProperty("dashClassifier", "-" + artifact.getClassifier());
extraExpressions.setProperty("dashClassifier?", "-" + artifact.getClassifier());
} else {
extraExpressions.setProperty("dashClassifier", "");
extraExpressions.setProperty("dashClassifier?", "");
}
valueSources.add(new PrefixedPropertiesValueSource(ARTIFACT_EXPRESSION_PREFIXES, extraExpressions, true));
for (ValueSource vs : valueSources) {
interpolator.addValueSource(vs);
}
RecursionInterceptor recursionInterceptor = new PrefixAwareRecursionInterceptor(ARTIFACT_EXPRESSION_PREFIXES);
try {
boolean useUniqueVersionsLayout = config.isUseUniqueVersions();
final String resolvedLayout;
switch (layoutType) {
case ManifestConfiguration.CLASSPATH_LAYOUT_TYPE_SIMPLE:
resolvedLayout = useUniqueVersionsLayout ? SIMPLE_LAYOUT : SIMPLE_LAYOUT_NONUNIQUE;
break;
case ManifestConfiguration.CLASSPATH_LAYOUT_TYPE_REPOSITORY:
resolvedLayout = useUniqueVersionsLayout ? REPOSITORY_LAYOUT : REPOSITORY_LAYOUT_NONUNIQUE;
break;
case ManifestConfiguration.CLASSPATH_LAYOUT_TYPE_CUSTOM:
resolvedLayout = layout;
break;
default:
throw new MojoExecutionException("Unknown classpath layout type: " + layoutType);
}
return Paths.get(interpolator.interpolate(resolvedLayout, recursionInterceptor));
} catch (InterpolationException e) {
throw new MojoExecutionException("Error computing path for classpath entry", e);
}
}