|Op. System:||Windows XP/2000/98|
|File size:||328 KB|
|Publisher:||Erik Jan de Wit|
Publisher description for Pojo Generator
The PojoGenerator is build using Spring and if your application also uses spring it's dead simple to get it going. If you do not use spring, don't worry you can still use it. So your're backed isn't done yet so you properly defined an interface. This is we're the PojoGenerator steps in. The PojoGenerator dynamically implements this interface by using spring aop. When you're code uses one of the methods of you're interface the PojoGenerator will try to figure out what domain object it needs to create, this is what we call Domain item revolving, methods to determine this) and instantiate it. Domain item resolving there are Currently two different types: * 'return type' Analysis * 'method name' analysis 'Return type' analysis is a simple method by using Reflection we can easily figure out what to return. This will only FAIL when you're program expects an collection and you are using java1.4. 'Method name' will take the name of method and try to find a domain model object name in it. So if you're interface has a method like findAllCatByName, this method will succeed and know it's Cats we need to instantiate. So the PojoGenerator knows what object to create, than it needs to initialize the fields of this object. When you don't configure anything it's hard to generate useful data. The PojoGenerator comes with standard instantiators for the common classes for example an int in your domain object will get a random value between 1 and 15. This is properly not an very good value for the cat age, or what ever the field in you're domain model represents. To produce more "meaningful" data a configuration needs to be made in xml. We'll discuss the configuration in chunks in the end we'll put it all together.