atom feed11 messages in org.codehaus.esper.devRe: [esper-dev] Accessing an array in...
FromSent OnAttachments
Gavin1234Oct 3, 2008 1:36 am 
Thomas BernhardtOct 3, 2008 3:56 am 
Thomas BernhardtOct 3, 2008 6:39 am 
Gavin1234Oct 3, 2008 7:06 am 
Thomas BernhardtOct 3, 2008 4:52 pm 
Gavin1234Oct 6, 2008 8:45 am 
Thomas BernhardtOct 7, 2008 3:52 am 
Gavin1234Oct 7, 2008 4:50 am 
Thomas BernhardtOct 7, 2008 5:00 am 
Gavin1234Oct 7, 2008 6:46 am 
Thomas BernhardtOct 7, 2008 7:31 am 
Subject:Re: [esper-dev] Accessing an array in EPL
From:Gavin1234 (g.ch@btinternet.com)
Date:Oct 7, 2008 4:50:30 am
List:org.codehaus.esper.dev

How would I do this using the HashMaps in the example below? The definition requires a class, and putting a '[]' as below would result in an array of HashMaps....

One of the areas we are looking at is the possibility of our container having the ability to define aliases, where pojos aren't known to the esper container, hence the use of nested maps...

Thanks for your continued help, Gavin

Thomas Bernhardt wrote:

The infrastructure we have would seem to support this requirement by allowing the alias of a nested type to appear as a value in the type definition, perhaps appending "[]" to the alias would then indicate that a property is itself an array of a nestable Map. Do you have specific use cases in mind for complex Map types as compared to Pojos? Best regards, Tom

----- Original Message ---- From: Gavin1234 <g.ch@btinternet.com> To: de@esper.codehaus.org Sent: Monday, October 6, 2008 11:45:12 AM Subject: Re: [esper-dev] Accessing an array in EPL

Thanks Tom, just out of interest, how do I define an array in a nested map, when the field is another nested map? For instance, I'd like to translate my pojos to nested maps, so in the first example I have

HashMap<String, Object> prop = new HashMap<String, Object>(); prop.put("route", String[].class); prop.put("id", Integer.class);

Now, if route is actually an array of POJOs, I'd put in something like: prop.put("route", RoutePOJO[].class);

But if I want to keep pojos out of this and define RoutePOJO as a Map... how do I declare an array...?

HashMap<String, Object> routeMap = new HashMap<String, Object>(); routeMap.put("id", Integer.class); // this simply defines our pojo

HashMap<String, Object> prop = new HashMap<String, Object>(); prop.put("route", routeMap[].class); // I'd like this to be an array of Route pojos defined using maps prop.put("id", Integer.class);

We have a particular interest in using nested maps to represent pojos, so any help on this aspect would be appreciated. Best, Gavin