@Test public void testParsePathExpression() { assertEquals("foo+bar", ObjectPathExpressionParser.parsePathExpression(null, "foo.bar", new DoIt()) .toString()); assertEquals("foo+bar", ObjectPathExpressionParser.parsePathExpression(null, "foo[bar]", new DoIt()) .toString()); assertEquals("foo+bar+baz", ObjectPathExpressionParser .parsePathExpression(null, "foo[bar].baz", new DoIt()) .toString()); assertEquals( "foo+bar[baz]", ObjectPathExpressionParser.parsePathExpression(null, "foo[bar[baz]]", new DoIt()).toString()); assertEquals( "foo+bar-bar.baz+fez", ObjectPathExpressionParser.parsePathExpression(null, "foo[bar-bar.baz]+fez", new DoIt()).toString()); }
@SuppressWarnings("unchecked") public static <T> T parsePathExpression(Object root, String path, final PathEntry pathEntry) { ParseState parseState = (ParseState) TL_EL_PARSE_STATE.get(); boolean recycle; if (parseState == null) { TL_EL_PARSE_STATE.set(new ParseState()); parseState = TL_EL_PARSE_STATE.get(); recycle = true; } else if (parseState.isActive()) { ProcessLogger.ntrace("el-parse:", ":nested", 100); parseState = new ParseState(); recycle = false; } else { recycle = true; } try { parseState.originalPath = path; parseState.originalPathIndex = 0; parseState.parentPath = null; parseState.currentContinuation = pathEntry.parse(null, root, null); while (path != null) { path = parseState.prepareNextScan(path); parseState.scan(path); path = parseState.step(path, pathEntry); } return (T) parseState.currentContinuation; } finally { assert !recycle || parseState == TL_EL_PARSE_STATE.get(); parseState.reset(); } }
ObjectPathExpressionParser { @SuppressWarnings("unchecked") public static <T> T parsePathExpression(Object root, String path, final PathEntry pathEntry) { ParseState parseState = (ParseState) TL_EL_PARSE_STATE.get(); boolean recycle; if (parseState == null) { TL_EL_PARSE_STATE.set(new ParseState()); parseState = TL_EL_PARSE_STATE.get(); recycle = true; } else if (parseState.isActive()) { ProcessLogger.ntrace("el-parse:", ":nested", 100); parseState = new ParseState(); recycle = false; } else { recycle = true; } try { parseState.originalPath = path; parseState.originalPathIndex = 0; parseState.parentPath = null; parseState.currentContinuation = pathEntry.parse(null, root, null); while (path != null) { path = parseState.prepareNextScan(path); parseState.scan(path); path = parseState.step(path, pathEntry); } return (T) parseState.currentContinuation; } finally { assert !recycle || parseState == TL_EL_PARSE_STATE.get(); parseState.reset(); } } }
ObjectPathExpressionParser { @SuppressWarnings("unchecked") public static <T> T parsePathExpression(Object root, String path, final PathEntry pathEntry) { ParseState parseState = (ParseState) TL_EL_PARSE_STATE.get(); boolean recycle; if (parseState == null) { TL_EL_PARSE_STATE.set(new ParseState()); parseState = TL_EL_PARSE_STATE.get(); recycle = true; } else if (parseState.isActive()) { ProcessLogger.ntrace("el-parse:", ":nested", 100); parseState = new ParseState(); recycle = false; } else { recycle = true; } try { parseState.originalPath = path; parseState.originalPathIndex = 0; parseState.parentPath = null; parseState.currentContinuation = pathEntry.parse(null, root, null); while (path != null) { path = parseState.prepareNextScan(path); parseState.scan(path); path = parseState.step(path, pathEntry); } return (T) parseState.currentContinuation; } finally { assert !recycle || parseState == TL_EL_PARSE_STATE.get(); parseState.reset(); } } private  ObjectPathExpressionParser(); }
ObjectPathExpressionParser { @SuppressWarnings("unchecked") public static <T> T parsePathExpression(Object root, String path, final PathEntry pathEntry) { ParseState parseState = (ParseState) TL_EL_PARSE_STATE.get(); boolean recycle; if (parseState == null) { TL_EL_PARSE_STATE.set(new ParseState()); parseState = TL_EL_PARSE_STATE.get(); recycle = true; } else if (parseState.isActive()) { ProcessLogger.ntrace("el-parse:", ":nested", 100); parseState = new ParseState(); recycle = false; } else { recycle = true; } try { parseState.originalPath = path; parseState.originalPathIndex = 0; parseState.parentPath = null; parseState.currentContinuation = pathEntry.parse(null, root, null); while (path != null) { path = parseState.prepareNextScan(path); parseState.scan(path); path = parseState.step(path, pathEntry); } return (T) parseState.currentContinuation; } finally { assert !recycle || parseState == TL_EL_PARSE_STATE.get(); parseState.reset(); } } private  ObjectPathExpressionParser(); static int indexOfCloseBracket(String path, int leftBracketIndex); static boolean isPath(String propertyName); @SuppressWarnings("unchecked") static T parsePathExpression(Object root, String path, final PathEntry pathEntry); }
ObjectPathExpressionParser { @SuppressWarnings("unchecked") public static <T> T parsePathExpression(Object root, String path, final PathEntry pathEntry) { ParseState parseState = (ParseState) TL_EL_PARSE_STATE.get(); boolean recycle; if (parseState == null) { TL_EL_PARSE_STATE.set(new ParseState()); parseState = TL_EL_PARSE_STATE.get(); recycle = true; } else if (parseState.isActive()) { ProcessLogger.ntrace("el-parse:", ":nested", 100); parseState = new ParseState(); recycle = false; } else { recycle = true; } try { parseState.originalPath = path; parseState.originalPathIndex = 0; parseState.parentPath = null; parseState.currentContinuation = pathEntry.parse(null, root, null); while (path != null) { path = parseState.prepareNextScan(path); parseState.scan(path); path = parseState.step(path, pathEntry); } return (T) parseState.currentContinuation; } finally { assert !recycle || parseState == TL_EL_PARSE_STATE.get(); parseState.reset(); } } private  ObjectPathExpressionParser(); static int indexOfCloseBracket(String path, int leftBracketIndex); static boolean isPath(String propertyName); @SuppressWarnings("unchecked") static T parsePathExpression(Object root, String path, final PathEntry pathEntry);  }