[
https://issues.apache.org/jira/browse/METRON-706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15858321#comment-15858321
]
ASF GitHub Bot commented on METRON-706:
---------------------------------------
Github user mmiklavc commented on a diff in the pull request:
https://github.com/apache/incubator-metron/pull/445#discussion_r100129984
--- Diff:
metron-platform/metron-common/src/main/java/org/apache/metron/common/utils/ConversionUtils.java
---
@@ -35,6 +35,14 @@ protected ConvertUtilsBean initialValue() {
}
};
+ public static <T> T convertOrFail(Object o, Class<T> clazz) {
+ if (clazz.isInstance(o)) {
--- End diff --
Good point. I'm removing this entirely. I'll just use casting in place, e.g.
**Example 1**
`String val = (String) map.get("foo"); // throws class cast exception on
failure, which is what we want`
**Example 2**
```
Map<Object, Object> a = new HashMap() {{
put("hello", "world");
put(1, 2);
}};
Map<String, Object> b = new HashMap() {{
put("a", a);
}};
Map<Object, Object> c = (Map) b.get("a"); // throws class cast exception if
not a Map
Map<String, String> d = new HashMap<>();
for (Map.Entry<Object, Object> entry : c.entrySet()) {
d.put((String) entry.getKey(), (String) entry.getValue()); // throws
class cast exception. also what we want
}
```
> Add Stellar transformations and filters to enrichment and threat intel loaders
> ------------------------------------------------------------------------------
>
> Key: METRON-706
> URL: https://issues.apache.org/jira/browse/METRON-706
> Project: Metron
> Issue Type: Improvement
> Reporter: Michael Miklavcic
> Assignee: Michael Miklavcic
>
> This Jira tracks work to add the ability to transform and filter data being
> loaded into the enrichment and threatintel HBase tables.
> This effort builds on the work in:
> https://issues.apache.org/jira/browse/METRON-678
> and
> https://issues.apache.org/jira/browse/METRON-682
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)