Search in sources :

Example 1 with UserType

use of com.robotoworks.mechanoid.net.netModel.UserType in project mechanoid by robotoworks.

the class JsonWriterStatementGenerator method _genStatementForUserTypeGenericList.

protected CharSequence _genStatementForUserTypeGenericList(final TypedMember member, final GenericListType type, final UserType itemType, final EnumTypeDeclaration decl) {
    StringConcatenation _builder = new StringConcatenation();
    ImportHelper _imports = this.getImports();
    _imports.addImport("java.util.List");
    _builder.newLineIfNotEmpty();
    ImportHelper _imports_1 = this.getImports();
    _imports_1.addImport("java.util.ArrayList");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("if(");
    String _getMethodName = ModelExtensions.toGetMethodName(member);
    String _subjectIdentifier = this.getSubjectIdentifier();
    String _memberize = ModelExtensions.memberize(_getMethodName, _subjectIdentifier);
    _builder.append(_memberize, "");
    _builder.append("() != null) {");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.newLine();
    _builder.append("\t");
    String _writerIdentifier = this.getWriterIdentifier();
    _builder.append(_writerIdentifier, "\t");
    _builder.append(".name(\"");
    String _name = member.getName();
    _builder.append(_name, "\t");
    _builder.append("\");");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.newLine();
    _builder.append("\t");
    String _writerIdentifier_1 = this.getWriterIdentifier();
    _builder.append(_writerIdentifier_1, "\t");
    _builder.append(".beginArray();");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("for(");
    Type _type = member.getType();
    String _innerSignature = ModelExtensions.innerSignature(_type);
    _builder.append(_innerSignature, "\t");
    _builder.append(" element : ");
    String _getMethodName_1 = ModelExtensions.toGetMethodName(member);
    String _subjectIdentifier_1 = this.getSubjectIdentifier();
    String _memberize_1 = ModelExtensions.memberize(_getMethodName_1, _subjectIdentifier_1);
    _builder.append(_memberize_1, "\t");
    _builder.append("()) {");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    String _writerIdentifier_2 = this.getWriterIdentifier();
    _builder.append(_writerIdentifier_2, "\t\t");
    _builder.append(".value(element.toString());");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.newLine();
    _builder.append("\t");
    String _writerIdentifier_3 = this.getWriterIdentifier();
    _builder.append(_writerIdentifier_3, "\t");
    _builder.append(".endArray();");
    _builder.newLineIfNotEmpty();
    _builder.append("}");
    _builder.newLine();
    return _builder;
}
Also used : Type(com.robotoworks.mechanoid.net.netModel.Type) IntrinsicType(com.robotoworks.mechanoid.net.netModel.IntrinsicType) UserType(com.robotoworks.mechanoid.net.netModel.UserType) GenericListType(com.robotoworks.mechanoid.net.netModel.GenericListType) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) ImportHelper(com.robotoworks.mechanoid.net.generator.ImportHelper)

Aggregations

ImportHelper (com.robotoworks.mechanoid.net.generator.ImportHelper)1 GenericListType (com.robotoworks.mechanoid.net.netModel.GenericListType)1 IntrinsicType (com.robotoworks.mechanoid.net.netModel.IntrinsicType)1 Type (com.robotoworks.mechanoid.net.netModel.Type)1 UserType (com.robotoworks.mechanoid.net.netModel.UserType)1 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)1