當前位置: 首頁>>代碼示例>>Java>>正文


Java ValueSource類代碼示例

本文整理匯總了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();
    }
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:34,代碼來源:AbstractStringBasedModelInterpolator.java

示例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();
    }
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:26,代碼來源:StringSearchModelInterpolator.java

示例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();
    }
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:20,代碼來源:StringSearchModelInterpolator.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:CustomMaven3ModelInterpolator2.java

示例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;
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:15,代碼來源:StringSearchModelInterpolator.java

示例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;
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:9,代碼來源:ProblemDetectingValueSource.java

示例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;
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:16,代碼來源:StringSearchModelInterpolator.java

示例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);
  }
}
 
開發者ID:HubSpot,項目名稱:SlimFast,代碼行數:56,代碼來源:ArtifactHelper.java


注:本文中的org.codehaus.plexus.interpolation.ValueSource類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。