Maybe for your application the
Builder pattern might be a good fit. It is a little bit like the Factory pattern, but allows you to pass parameters to the builder before building your object.
An advantage of having a separate builder to build some complex object over just making the complex object a bean with getters and setters, is that you can make the complex object immutable (which makes it simpler to work with, especially when you have multiple threads that might be concurrently using the object - if it's immutable, you don't need to worry about synchronization because multiple threads might try to modify the object.
The examples on Wikipedia for the Builder pattern is not that good in my opinion, so here's an example of where I'm using this in the project I'm currently working at.
In our project we have to create messages. A messsage has a type (for which we have an enum) and can contain fields. We have a MessageBuilder class that's the builder for Message objects. You pass it the message type, then you can add fields to the builder, and at the end you call the
build method to create the Message object. The builder's methods return
this, so that you can chain them. Something like this:
Ofcourse you could make the
build method so that it would return different subclasses of Message, if that's what you want.