Skip to content
This repository has been archived by the owner on Mar 21, 2023. It is now read-only.

add key-value parsing function #77

Merged
merged 4 commits into from
Aug 8, 2016
Merged

add key-value parsing function #77

merged 4 commits into from
Aug 8, 2016

Conversation

kroepke
Copy link
Member

@kroepke kroepke commented Aug 4, 2016

fixes #38

@kroepke kroepke added this to the 1.1.0 milestone Aug 4, 2016

public KeyValue() {
valueParam = string("value").build();
splitParam = string("delimiter", CharMatcher.class).transform(CharMatcher::anyOf).optional().build();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there is possibly more than 1 delimiter, the parameter should be called delimiters.

@bernd
Copy link
Member

bernd commented Aug 8, 2016

@kroepke This also needs a rebase, thanks!

@kroepke
Copy link
Member Author

kroepke commented Aug 8, 2016

@bernd pushed

@Override
public Map<String, String> evaluate(FunctionArgs args, EvaluationContext context) {
final String value = valueParam.required(args, context);
if (value == null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to short cut here for an empty value as well? (i.e. value="" or value=" ")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point!

@bernd
Copy link
Member

bernd commented Aug 8, 2016

LGTM 👍

@bernd bernd merged commit 812b245 into master Aug 8, 2016
@bernd bernd deleted the kv-parse branch August 8, 2016 14:53
edmundoa pushed a commit that referenced this pull request Aug 30, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide a key=value function
3 participants