Skip to content

Instantly share code, notes, and snippets.

@KylianVermeulen
Created December 6, 2021 10:18
Show Gist options
  • Save KylianVermeulen/181f64fb65b0e672c7b66b6b730d91fd to your computer and use it in GitHub Desktop.
Save KylianVermeulen/181f64fb65b0e672c7b66b6b730d91fd to your computer and use it in GitHub Desktop.
Spel Expression Parser
private static final SpelExpressionParser PARSER = new SpelExpressionParser();
String[] fields = {"userLanguage", "query.queryParameters"};
List<Object> objects = Stream.of(fields).map(field -> PARSER.parseExpression(field).getValue(searchModel)).filter(Objects::nonNull).collect(Collectors.toList());
logger.debug("Not Null: " + objects);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment