I'm learning for a job interview in Java. They told me to learn the concepts of Beans introspection, so I searched the web and read in a couple of sites including the next posts:
As far as I understood: Bean is like any other object class in Java, but this class must have the next features:
General things:
I still have some questions:
I would be happy if someone could give me his own prospective about this subject, or to give me some kind of a link for useful information.
I'm not sure what they want to know.
You can use frameworks such as apache-bean-utils to query information about bean structure.
I developed such a code manually (big mistake! :) ) -
I used a recursive mechanism based on java bean notation (i.e - setters must begin with "set",
getters begin with "is" for boolean or "get" for all types)
You then can us this code to automate some behavior -
At my case fo example I wrote a tool that parses WSDL, and creates binding between WS calls
and our application entitites via code.
The user of our application provided an XML indicating how to perform a mapping -
i.e - let's say that a WS call returned a Person object, but in our application we had a student entity
so the XML defined how to perform the mapping, and I used code like apache-bean-utils to perform introspection
and to understand what setters and getters to invoke.
This was done in contrast to what is done usually in java applications:
1. Generate Java clients (i.e - use wsdl2java) from WSDL
2. Compile the application with the client code.
I can assume introspection can be used in profilers code - for example,
Since there are many frameworks that use getters and setters , it is very improtant that these methods will be efficient,
so it's something that mabye profiles should first look into.
Feel free to add more questions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With