builder.append(
Stmt.if_(Bool.expr(loadVariable("a1").invoke("hasObject", loadVariable("objId"))))
.append(loadVariable("a1")
.invoke("getObject", toMap, loadVariable("objId")).returnValue()).finish());
final InstantiationMapping instantiationMapping = mappingDefinition.getInstantiationMapping();
/**
* Figure out how to construct this object.
*/
final Mapping[] cMappings = instantiationMapping.getMappings();
if (cMappings.length > 0) {
// use constructor mapping.
final List<String> memberKeys = new ArrayList<String>();
for (MemberMapping memberMapping : mappingDefinition.getMemberMappings()) {
memberKeys.add(memberMapping.getKey());
}
final Statement[] constructorParameters = new Statement[cMappings.length];
for (final Mapping mapping : instantiationMapping.getMappingsInKeyOrder(memberKeys)) {
int parmIndex = instantiationMapping.getIndex(mapping.getKey());
final MetaClass type = mapping.getType().asBoxed();
BlockBuilder<?> lazyInitMethod = (needsLazyInit(type)) ? initMethod : null;
if (type.isArray()) {
MetaClass toMap = type;
while (toMap.isArray()) {