groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chavan77 <chava...@hotmail.com>
Subject Handling multiple levels of unresolved properties
Date Tue, 28 Jun 2016 07:24:11 GMT
In my groovy DSL, it is possible to drill down into a piece of data, with
each level being handled dynamically

For example A is an entity that holds B which holds another entity C.

A.B.C.D will get the field D in the C entity. All entities are dynamically
created, meaning A does not have a field B, which does not have a field C
which does not have D. They are all looked up dynamically using getProperty.

a) How do I write a static type checker for this? I added a derived class
from AbstractTypeCheckingExtension. However for every missing property
(namely B, C and D) it calls handleMissingProperty inside this class. This
is cumbersome because only C knows it can contain D, likewise only B knows
about C and only A knows about B.

b) when handleMissingProperty is called for the missing D property, how do I
know that this was from the expression that starts with A, goes through B
and C. Meaning how do I walk the tree of the expression?

Is there a better way to do this?





--
View this message in context: http://groovy.329449.n5.nabble.com/Handling-multiple-levels-of-unresolved-properties-tp5733567.html
Sent from the Groovy Users mailing list archive at Nabble.com.

Mime
View raw message