POJO instantiator Utility

Just a random post for everyone.

If you don't know what Plain Old Java Object (POJO) is, take a look at Wikipedia's explanation thereof.

I have written a simple POJO instantiator. This instantiator is not fully perfect but it does what it was designed thus far.
My criteria I have choose of what constitutes a POJO is simple:
  1. A class must have a no constructor at all, or a public zero-argument constructor.
  2. The instance variables must have a respective getter and setter method (of which, both must be public).
What this utility class doesn't do is the following:
  1. It never instantiates a final instance or a static final instance.
  2. serialVersionUID is ignored.
  3. Array instance variables are not instantiated.
  4. Any instance variable which has the same type as the class it is declared is not instantiated. The reason is that the utility class will go into an infinite recursive loop and a StackOverflowError is thrown.
OK, enough of the pleasantries, let's get to the code, shall we? And here it is.




If you have found any issues or have further things to see from this utility, please feel free to comment below or give a shout out! :-)


Happy coding! :-)

Comments