New in 10.1 – Introduction to the Any Type

In Apama 10.1, we introduced a new type any to EPL, which can hold a value of any concrete EPL type (equivalent to Object type in Java or auto in C++). This means it is now possible to write EPL applications in much more generic ways. In this blog, we shall explore some of new possibilities, code simplifications and other benefits that the any type gives us. To get the full story on how any functions (what actions are available on it and similar) please refer to the samples or doc. For now, let’s look at some interesting code!

Generic actions

EPL’s strong typing is important for performance, but the common casting that comes with that is something of an annoyance. So how about a single library action to handle the common cases?

A functional approach

The any type also opens options to bring different paradigms into EPL, such as the below (featuring our add  action from previous example):

Factories

The following is useful for constructing events with user provided data :

Inheritance in EPL!?

Well, almost. Using any, we can define an interface with a reference to the inheriting object

There’s a lot more we can do with any, so watch out for further EPL blog posts to help extend your knowledge. As always, please post on our forums or leave a comment below with any questions or statements you may have.Can you come up with a use for any that we haven’t? Thanks, and happy developing!

Ashish