Aug 24, 2017 · 1 min read
It doesn’t necessarily need to be so ugly. You would typically have a HashMap<String, String> that maps the “generic” names to the “platform-specific” ones, and then do:
public FunalyticsEvent transformEvent(@NonNull Event event) {
String mappedName = mappings.get(event.name); FunalyticsParams params = .... // convert event.params to the format that Funalytics expects
return new Funalytics(mappedName == null ? event.name : mappedName, params);
}
