aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/mitchellbosecke
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-05-23 14:47:38 +0300
committerGravatar Vitaly Takmazov2017-05-23 15:50:32 +0300
commitbe30d843aab467aa628f1c3f3c7d194bfda54284 (patch)
tree4185a4e0c084aa1a0e0072af5153fd895edf440c /juick-www/src/main/java/com/mitchellbosecke
parent4c6f3ba0d539f63a83c18e20ed4219bdef849b81 (diff)
fix style
Diffstat (limited to 'juick-www/src/main/java/com/mitchellbosecke')
-rw-r--r--juick-www/src/main/java/com/mitchellbosecke/pebble/extension/FormatterExtension.java2
-rw-r--r--juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java23
2 files changed, 25 insertions, 0 deletions
diff --git a/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/FormatterExtension.java b/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/FormatterExtension.java
index 220e0460..198e9668 100644
--- a/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/FormatterExtension.java
+++ b/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/FormatterExtension.java
@@ -2,6 +2,7 @@ package com.mitchellbosecke.pebble.extension;
import com.mitchellbosecke.pebble.extension.filters.FormatMessageFilter;
import com.mitchellbosecke.pebble.extension.filters.PrettyTimeFilter;
+import com.mitchellbosecke.pebble.extension.filters.TagsListFilter;
import java.util.HashMap;
import java.util.Map;
@@ -15,6 +16,7 @@ public class FormatterExtension extends AbstractExtension {
Map<String, Filter> filters = new HashMap<>();
filters.put("formatMessage", new FormatMessageFilter());
filters.put("prettyTime", new PrettyTimeFilter());
+ filters.put("tagsList", new TagsListFilter());
return filters;
}
}
diff --git a/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java b/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java
new file mode 100644
index 00000000..55c98307
--- /dev/null
+++ b/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java
@@ -0,0 +1,23 @@
+package com.mitchellbosecke.pebble.extension.filters;
+
+import com.juick.Tag;
+import com.mitchellbosecke.pebble.extension.Filter;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * Created by vitalyster on 23.05.2017.
+ */
+public class TagsListFilter implements Filter {
+ @Override
+ public Object apply(Object input, Map<String, Object> args) {
+ return ((List<Tag>) input).stream().map(Tag::getName).collect(Collectors.toList());
+ }
+
+ @Override
+ public List<String> getArgumentNames() {
+ return null;
+ }
+}