Is what I'm doing below a common design pattern? If so, what's the name?
I have a complex object that has "simple" fields like Strings and lists of Strings, as well as other complex objects. I want to add instances of this object to a JMS message queue, which means they need to be Serializable
. I don't want to make the entire object graph Serializable
, so I've chosen instead to make "Descriptor" objects that contain the necessary information to build the complex objects and "Builder" objects that can create the objects. Now, I serialize the "Descriptor" object and add it to the queue. When the object is dequeued, it is built into a full-fledged object using the "Builder".
An important note to make is that the objects are jobs that are run on other systems. The message queue is one way and serialization only happens at the beginning of the lifecycle of the job.