protected void constructDeserializedObject( @Nonnull DomainObjectDescriptor domainObjectDescriptor, @Nonnull JMethod deserializeMethod, @Nonnull Map<FieldWithInitializationInfo, JVar> fieldToVar ) {
deserializeMethod.body().directStatement( "//Constructing the deserialized object" );
//Now create the constructor for the deserializeMethod
JClass domainType = codeGenerator.ref( domainObjectDescriptor.getQualifiedName() );
JInvocation domainTypeInit = JExpr._new( domainType );
//Add the arguments for the fields
List<? extends FieldInitializedInConstructorInfo> fieldsToSerialize = domainObjectDescriptor.getFieldsInitializedInConstructor();
for ( FieldInitializedInConstructorInfo fieldInfo : fieldsToSerialize ) {
domainTypeInit.arg( fieldToVar.get( fieldInfo ) );
}
//Add the object type
JVar domainObjectVar = deserializeMethod.body().decl( domainType, VAR_NAME_OBJECT, domainTypeInit );