That's because you're invoking the builder
's build method and throwing the result away. Save the result:
request = builder.messageID(new MessageID(23, 34, 12));
Note that this isn't really an example of the Builder pattern; it's really a Factory. Most useful Builder classes use a fluent API to make the process clear and less bug-prone, and the Builder object contains the intermediate state necessary to construct the new instance, such as this:
request = new BaseServiceRequestBuilder().boi1(23).doi2(34).co3(12).build();
If you already had the MessageID
object, perhaps from some incoming request, the Builder might also accept it as a parameter:
request = new BaseServiceRequestBuilder().messageID(id).build();