Java Code Examples for org.apache.ivy.core.IvyPatternHelper#substituteVariables()

The following examples show how to use org.apache.ivy.core.IvyPatternHelper#substituteVariables() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Match.java    From ant-ivy with Apache License 2.0 6 votes vote down vote up
public Matcher getPatternMatcher(ModuleRevisionId askedMrid) {
    String revision = askedMrid.getRevision();

    List<String> args = split(getArgs());
    List<String> argValues = getRevisionArgs(revision);

    if (args.size() != argValues.size()) {
        return new NoMatchMatcher();
    }

    Map<String, String> variables = new HashMap<>();
    for (String arg : args) {
        variables.put(arg, argValues.get(args.indexOf(arg)));
    }

    String pattern = getPattern();
    pattern = IvyPatternHelper.substituteVariables(pattern, variables);

    PatternMatcher pMatcher = IvyContext.getContext().getSettings().getMatcher(matcher);
    return pMatcher.getMatcher(pattern);
}
 
Example 2
Source File: IvyPatternHelperTest.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@Test(expected = Exception.class)
public void testCyclicSubstitute() {
    String pattern = "${var}";
    Map<String, String> variables = new HashMap<>();
    variables.put("var", "${othervar}");
    variables.put("othervar", "${var}");

    IvyPatternHelper.substituteVariables(pattern, variables);
}
 
Example 3
Source File: IvyXmlModuleDescriptorParser.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private String substitute(String value) {
    return IvyPatternHelper.substituteVariables(value, properties);
}
 
Example 4
Source File: IvyXmlModuleDescriptorParser.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private String substitute(String name) {
    return IvyPatternHelper.substituteVariables(name, properties);
}
 
Example 5
Source File: IvyXmlModuleDescriptorParser.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private String substitute(String value) {
    return IvyPatternHelper.substituteVariables(value, properties);
}
 
Example 6
Source File: IvyXmlModuleDescriptorParser.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private String substitute(String name) {
    return IvyPatternHelper.substituteVariables(name, properties);
}
 
Example 7
Source File: IvyVariableContainerImpl.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
protected String substitute(String value) {
    return IvyPatternHelper.substituteVariables(value, this);
}
 
Example 8
Source File: IvySettings.java    From ant-ivy with Apache License 2.0 2 votes vote down vote up
/**
 * Substitute variables in the given string by their value found in the current set of variables
 *
 * @param str
 *            the string in which substitution should be made
 * @return the string where all current ivy variables have been substituted by their value If
 *         the input str doesn't use any variable, the same object is returned
 */
public synchronized String substitute(String str) {
    return IvyPatternHelper.substituteVariables(str, variableContainer);
}