Reading some articles, it is best to have POJO object to do JSON or XML serialization. I am wondering whether POJO can have construtors or methods?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
"POJO" is a terrible name, but basically, yes, a Javabean class representing an entity would be extremely helpful in doing the JSON or XML serialization since there are so many API’s out which understands Javabeans and can convert between them and the desired format in a single code line. Last but not least, you can reuse the same Javabean class in all other layers of your application. E.g. to store data in a DB, or to transfer the data between layers, or to present the data to the enduser, etc.
And surely such a class can have constructors and methods.
See also: