/** * Creates a new instance and initializes it. Uses a default escaping character. * * @param <V> the type of the values in the map * @param valueMap the map with the variables' values, may be null * @param prefix the prefix for variables, not null * @param suffix the suffix for variables, not null * @throws IllegalArgumentException if the prefix or suffix is null */ public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix) { this(StrLookup.mapLookup(valueMap), prefix, suffix, DEFAULT_ESCAPE); }
/** * Creates a new instance and initializes it. Uses defaults for variable * prefix and suffix and the escaping character. * * @param <V> the type of the values in the map * @param valueMap the map with the variables' values, may be null */ public <V> StrSubstitutor(final Map<String, V> valueMap) { this(StrLookup.mapLookup(valueMap), DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE); }
/** * Creates a new instance and initializes it. * * @param <V> the type of the values in the map * @param valueMap the map with the variables' values, may be null * @param prefix the prefix for variables, not null * @param suffix the suffix for variables, not null * @param escape the escape character * @param valueDelimiter the variable default value delimiter, may be null * @throws IllegalArgumentException if the prefix or suffix is null * @since 3.2 */ public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix, final char escape, final String valueDelimiter) { this(StrLookup.mapLookup(valueMap), prefix, suffix, escape, valueDelimiter); }
/** * Creates a new instance and initializes it. * * @param <V> the type of the values in the map * @param valueMap the map with the variables' values, may be null * @param prefix the prefix for variables, not null * @param suffix the suffix for variables, not null * @param escape the escape character * @throws IllegalArgumentException if the prefix or suffix is null */ public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix, final char escape) { this(StrLookup.mapLookup(valueMap), prefix, suffix, escape); }
public BuildVariables(AgentRuntimeInfo agentRuntimeInfo, Clock clock) { this.clock = clock; this.staticLookup = StrLookup.mapLookup(map( "agent.location", agentRuntimeInfo.getLocation(), "agent.hostname", agentRuntimeInfo.getHostName() )); }
@Test public void testMapLookup() { final Map<String, Object> map = new HashMap<>(); map.put("key", "value"); map.put("number", Integer.valueOf(2)); assertEquals("value", StrLookup.mapLookup(map).lookup("key")); assertEquals("2", StrLookup.mapLookup(map).lookup("number")); assertNull(StrLookup.mapLookup(map).lookup(null)); assertNull(StrLookup.mapLookup(map).lookup("")); assertNull(StrLookup.mapLookup(map).lookup("other")); }
protected BuildSession newBuildSession() { return new BuildSession("build1", agentIdentifier, statusReporter, console, StrLookup.mapLookup(buildVariables), artifactsRepository, httpService, new TestingClock(), sandbox, "utf-8"); }
/** * Creates a new instance and initializes it. Uses a default escaping character. * * @param <V> the type of the values in the map * @param valueMap the map with the variables' values, may be null * @param prefix the prefix for variables, not null * @param suffix the suffix for variables, not null * @throws IllegalArgumentException if the prefix or suffix is null */ public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix) { this(StrLookup.mapLookup(valueMap), prefix, suffix, DEFAULT_ESCAPE); }
/** * Creates a new instance and initializes it. Uses a default escaping character. * * @param <V> the type of the values in the map * @param valueMap the map with the variables' values, may be null * @param prefix the prefix for variables, not null * @param suffix the suffix for variables, not null * @throws IllegalArgumentException if the prefix or suffix is null */ public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix) { this(StrLookup.mapLookup(valueMap), prefix, suffix, DEFAULT_ESCAPE); }
/** * Creates a new instance and initializes it. Uses defaults for variable * prefix and suffix and the escaping character. * * @param <V> the type of the values in the map * @param valueMap the map with the variables' values, may be null */ public <V> StrSubstitutor(final Map<String, V> valueMap) { this(StrLookup.mapLookup(valueMap), DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE); }
/** * Creates a new instance and initializes it. Uses defaults for variable * prefix and suffix and the escaping character. * * @param <V> the type of the values in the map * @param valueMap the map with the variables' values, may be null */ public <V> StrSubstitutor(final Map<String, V> valueMap) { this(StrLookup.mapLookup(valueMap), DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE); }
/** * Creates a new instance and initializes it. Uses a default escaping character. * * @param <V> the type of the values in the map * @param valueMap the map with the variables' values, may be null * @param prefix the prefix for variables, not null * @param suffix the suffix for variables, not null * @throws IllegalArgumentException if the prefix or suffix is null */ public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix) { this(StrLookup.mapLookup(valueMap), prefix, suffix, DEFAULT_ESCAPE); }
/** * Creates a new instance and initializes it. Uses defaults for variable * prefix and suffix and the escaping character. * * @param <V> the type of the values in the map * @param valueMap the map with the variables' values, may be null */ public <V> StrSubstitutor(final Map<String, V> valueMap) { this(StrLookup.mapLookup(valueMap), DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE); }
/** * Creates a new instance and initializes it. * * @param <V> the type of the values in the map * @param valueMap the map with the variables' values, may be null * @param prefix the prefix for variables, not null * @param suffix the suffix for variables, not null * @param escape the escape character * @throws IllegalArgumentException if the prefix or suffix is null */ public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix, final char escape) { this(StrLookup.mapLookup(valueMap), prefix, suffix, escape); }
/** * Creates a new instance and initializes it. * * @param <V> the type of the values in the map * @param valueMap the map with the variables' values, may be null * @param prefix the prefix for variables, not null * @param suffix the suffix for variables, not null * @param escape the escape character * @throws IllegalArgumentException if the prefix or suffix is null */ public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix, final char escape) { this(StrLookup.mapLookup(valueMap), prefix, suffix, escape); }
/** * Creates a new instance and initializes it. * * @param <V> the type of the values in the map * @param valueMap the map with the variables' values, may be null * @param prefix the prefix for variables, not null * @param suffix the suffix for variables, not null * @param escape the escape character * @throws IllegalArgumentException if the prefix or suffix is null */ public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix, final char escape) { this(StrLookup.mapLookup(valueMap), prefix, suffix, escape); }
/** * Creates a new instance and initializes it. * * @param <V> the type of the values in the map * @param valueMap the map with the variables' values, may be null * @param prefix the prefix for variables, not null * @param suffix the suffix for variables, not null * @param escape the escape character * @param valueDelimiter the variable default value delimiter, may be null * @throws IllegalArgumentException if the prefix or suffix is null * @since 3.2 */ public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix, final char escape, final String valueDelimiter) { this(StrLookup.mapLookup(valueMap), prefix, suffix, escape, valueDelimiter); }
/** * Creates a new instance and initializes it. * * @param <V> the type of the values in the map * @param valueMap the map with the variables' values, may be null * @param prefix the prefix for variables, not null * @param suffix the suffix for variables, not null * @param escape the escape character * @param valueDelimiter the variable default value delimiter, may be null * @throws IllegalArgumentException if the prefix or suffix is null * @since 3.2 */ public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix, final char escape, final String valueDelimiter) { this(StrLookup.mapLookup(valueMap), prefix, suffix, escape, valueDelimiter); }
/** * Creates a new instance and initializes it. * * @param <V> the type of the values in the map * @param valueMap the map with the variables' values, may be null * @param prefix the prefix for variables, not null * @param suffix the suffix for variables, not null * @param escape the escape character * @param valueDelimiter the variable default value delimiter, may be null * @throws IllegalArgumentException if the prefix or suffix is null * @since 3.2 */ public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix, final char escape, final String valueDelimiter) { this(StrLookup.mapLookup(valueMap), prefix, suffix, escape, valueDelimiter); }