Closed AlhassanReda closed 6 years ago
Thank you very much for your suggestion.
I much prefer discussing the design of an idea first before looking into actual code, which is why I have rejected your pull request.
I understand you're thinking of implementing some expression language that abstracts over individual method calls. The specific use case you would like to see covered is accessing array elements by index, even in nested paths.
However, I'm pretty sure your current design and solution are lacking tons of things. I don't think we should rush such a big feature into jOOR. Besides, there are good expression language libraries in existence already, including Spring, so why not use that, instead? https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#expressions
you didn't even check the code . i know my english is suck but try to look at the code and you will see
you didn't even check the code .
Yes, that's what I said. I said "I much prefer discussing the design of an idea first before looking into actual code"
Another important thing I said was: "However, I'm pretty sure your current design and solution are lacking tons of things. I don't think we should rush such a big feature into jOOR"
I'm sorry, I really cannot currently consider your PR, without a thorough discussion about the vision and design of such a feature set.
the idea is very simple this is jOOR code:
Employee[] employees = on(department).call("getEmployees").get();
for (Employee employee : employees) {
Street street = on(employee).call("getAddress").call("getStreet").get();
System.out.println(street);
}
My Implement :
Employee[] employees = ReflectFactory.getObject("getEmloyees()" ,department );
for (Employee employee : employees) {
Street street = ReflectFactory.getObject("getAddress()/getStreet()" ,employee);
System.out.println(street);
}
not just that you can call
Street street = ReflectFactory.getObject("getEmloyees()/[0]/getAddress()/getStreet()" ,department );
will return the first employee
Thank you for following up. I understand your general idea, I just don't think this is well thought through. There are tons of open questions, which I currently would not really like to address. First off, why invent an own "mini language", rather than just supporting standard Java EL?
Please do accept my rejection of this idea for the moment.
amazing view 👍 i was going to use JXPATH in my project but it didn't support get public field direct . so i created this . but any way you are 100% right , and i will think again before i started any features . thank you again for your time , and have a good time .
Hah :-) In my opinion, it would be much easier to extend JXPath to do some additional reflection magic, rather than re-implementing JXPath in this little reflection library called jOOR. Which again underlines my reservation...
next time i will , i promise 💯
hi i added full new branch of wrapped object by String path . for ex : if i have object from a class i and i need array first index value b/arr/[0] this will send to me value
not only that i make some observer list so any one can re call same path with different object very fast