/// <summary> /// Generates input mapping code block. /// </summary> /// <returns></returns> public virtual string BuildInputMappings() { var builder = new IndentedStringBuilder(); foreach (var transformation in InputParameterTransformation) { var nullCheck = BuildNullCheckExpression(transformation); bool conditionalAssignment = !string.IsNullOrEmpty(nullCheck) && !transformation.OutputParameter.IsRequired; if (conditionalAssignment) { builder.AppendLine("{0} {1} = null;", JavaCodeNamer.WrapPrimitiveType(transformation.OutputParameter.Type).Name, transformation.OutputParameter.Name); builder.AppendLine("if ({0}) {{", nullCheck).Indent(); } if (transformation.ParameterMappings.Any(m => !string.IsNullOrEmpty(m.OutputParameterProperty)) && transformation.OutputParameter.Type is CompositeType) { builder.AppendLine("{0}{1} = new {2}();", !conditionalAssignment ? transformation.OutputParameter.Type.Name + " " : "", transformation.OutputParameter.Name, transformation.OutputParameter.Type.Name); } foreach (var mapping in transformation.ParameterMappings) { builder.AppendLine("{0}{1}{2};", !conditionalAssignment && !(transformation.OutputParameter.Type is CompositeType) ? transformation.OutputParameter.Type.Name + " " : "", transformation.OutputParameter.Name, GetMapping(mapping)); } if (conditionalAssignment) { builder.Outdent() .AppendLine("}"); } } return(builder.ToString()); }
public virtual string TypeTokenType(IType type) { return(JavaCodeNamer.WrapPrimitiveType(type).Name); }