if (props != null && props.length > 0)
{
StringBuilder getExpression = new StringBuilder();
getExpression.append(objectVariable);
JType baseType = dtoType;
JClassType baseClassType = baseType.isClassOrInterface();
for (int i=0; i < props.length-1; i++)
{
if (baseClassType == null && i < props.length-1)
{
throw new NoSuchFieldException(propertyPath);
}
String prop = props[i];
JClassType propertyType = getTypeForProperty(prop, baseClassType).isClassOrInterface();
String getterMethod = getGetterMethod(prop, baseClassType);
String setterMethod = getSetterMethod(prop, baseClassType, propertyType);
out.println("if ("+getExpression.toString()+"."+getterMethod+"()==null){");
out.println(getExpression+"."+setterMethod+"(("+propertyType.getParameterizedQualifiedSourceName()+")"+GWT.class.getCanonicalName()+".create("+propertyType.getQualifiedSourceName()+".class));");
out.println("}");
getExpression.append("."+getterMethod+"()");
baseClassType = propertyType;
}
String prop = props[props.length-1];
JType propertyType = getTypeForProperty(prop, baseClassType);
String setterMethod = getSetterMethod(prop, baseClassType, propertyType);
out.println(getExpression+"."+setterMethod+"("+value+");");
return propertyType;
}