I am looking for solution to find the property name of given object in a mother object. I tried iterate through hall the mother object compare with objects with is operator, but I can get the property name from the mother class.
Pseudo Example:
Class Boo {
List<B> bb_property = []
}
Class Foo {
List<A> a_property = []
List<B> b_property = []
Boo boo = new Boo()
}
Foo foo = new Foo()
List<A> randomname = foo.a_property
String propertyname = foo.findPropertyNameOf(randomname) //this is here where the magic should happen
assert propertyname == "a_property"
List<A> someOtherRandomName = foo.boo.bb_property
propertyname = foo.findPropertyNameOf(someOtherRandomName) //this is here where the magic should happen
assert propertyname == "bb_property"