Commit 9b2d834a authored by Nico Mack's avatar Nico Mack

Extended API of ApplicationContext class

Fixed bug in Interpolator
parent 28e88d4b
......@@ -46,6 +46,12 @@ public class ApplicationContext {
// ---------------------------------------------------------------------------
public static boolean contains(String identifier) {
return context.containsKey(identifier);
}
// ---------------------------------------------------------------------------
public static Variable<?> getVariable(String identifier) {
return context.get(identifier);
}
......
......@@ -44,6 +44,9 @@ public class Interpolator {
// * Constants *
// ***************************************************************************
private static final String NULL_PATTERN = "null"; //$NON-NLS-1$
private static final String MATCH_ALL_PATTERN = "(.*)"; //$NON-NLS-1$
private static final String PARENTHESIS_OPENED = "("; //$NON-NLS-1$
private static final String PARENTHESIS_CLOSED = ")"; //$NON-NLS-1$
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
......@@ -186,6 +189,11 @@ public class Interpolator {
for (Chunk<?> chunk : chunks) {
builder.append(chunk.getPattern());
}
if (NULL_PATTERN.equals(builder.toString())) {
builder = new StringBuilder(MATCH_ALL_PATTERN);
}
return Pattern.compile(builder.toString(), Pattern.CASE_INSENSITIVE);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment