Search in sources :

Example 1 with GenericListType

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

the class EntityGenerator method _generateField.

protected CharSequence _generateField(final TypedMember member) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("private ");
    Type _type = member.getType();
    String _signature = ModelExtensions.signature(_type);
    _builder.append(_signature, "");
    _builder.append(" ");
    String _identifier = ModelExtensions.toIdentifier(member);
    _builder.append(_identifier, "");
    _builder.append(";");
    _builder.newLineIfNotEmpty();
    {
        Type _type_1 = member.getType();
        if ((_type_1 instanceof GenericListType)) {
            this.imports.addImport("java.util.List");
        }
    }
    _builder.append("\t");
    _builder.newLineIfNotEmpty();
    return _builder;
}
Also used : Type(com.robotoworks.mechanoid.net.netModel.Type) GenericListType(com.robotoworks.mechanoid.net.netModel.GenericListType) GenericListType(com.robotoworks.mechanoid.net.netModel.GenericListType) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 2 with GenericListType

use of com.robotoworks.mechanoid.net.netModel.GenericListType 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)

Example 3 with GenericListType

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

the class RequestGenerator method _buildConstructorArgsForType.

protected void _buildConstructorArgsForType(final GenericListType type, final List<String> args) {
    Type _elementType = type.getElementType();
    if ((_elementType instanceof IntrinsicType)) {
        String _signature = ModelExtensions.signature(type);
        String _plus = (_signature + " values");
        args.add(_plus);
    } else {
        String _signature_1 = ModelExtensions.signature(type);
        String _plus_1 = (_signature_1 + " ");
        String _innerSignature = ModelExtensions.innerSignature(type);
        String _camelize = Strings.camelize(_innerSignature);
        String _pluralize = Strings.pluralize(_camelize);
        String _plus_2 = (_plus_1 + _pluralize);
        args.add(_plus_2);
    }
}
Also used : IntrinsicType(com.robotoworks.mechanoid.net.netModel.IntrinsicType) StringType(com.robotoworks.mechanoid.net.netModel.StringType) Type(com.robotoworks.mechanoid.net.netModel.Type) BlockType(com.robotoworks.mechanoid.net.netModel.BlockType) IntrinsicType(com.robotoworks.mechanoid.net.netModel.IntrinsicType) UserType(com.robotoworks.mechanoid.net.netModel.UserType) GenericListType(com.robotoworks.mechanoid.net.netModel.GenericListType)

Example 4 with GenericListType

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

the class ResultGenerator method _generateBaseAccessor.

protected CharSequence _generateBaseAccessor(final TypedMember member) {
    StringConcatenation _builder = new StringConcatenation();
    {
        Type _type = member.getType();
        if ((_type instanceof GenericListType)) {
            this.imports.addImport("java.util.List");
        }
    }
    _builder.newLineIfNotEmpty();
    _builder.append("public ");
    Type _type_1 = member.getType();
    String _signature = ModelExtensions.signature(_type_1);
    _builder.append(_signature, "");
    _builder.append(" ");
    String _getMethodName = ModelExtensions.toGetMethodName(member);
    _builder.append(_getMethodName, "");
    _builder.append("(){");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("return base.");
    String _getMethodName_1 = ModelExtensions.toGetMethodName(member);
    _builder.append(_getMethodName_1, "\t");
    _builder.append("();");
    _builder.newLineIfNotEmpty();
    _builder.append("}");
    _builder.newLine();
    _builder.append("public void ");
    String _setMethodName = ModelExtensions.toSetMethodName(member);
    _builder.append(_setMethodName, "");
    _builder.append("(");
    Type _type_2 = member.getType();
    String _signature_1 = ModelExtensions.signature(_type_2);
    _builder.append(_signature_1, "");
    _builder.append(" value){");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("base.");
    String _setMethodName_1 = ModelExtensions.toSetMethodName(member);
    _builder.append(_setMethodName_1, "\t");
    _builder.append("(value);");
    _builder.newLineIfNotEmpty();
    _builder.append("}");
    _builder.newLine();
    return _builder;
}
Also used : Type(com.robotoworks.mechanoid.net.netModel.Type) BlockType(com.robotoworks.mechanoid.net.netModel.BlockType) IntrinsicType(com.robotoworks.mechanoid.net.netModel.IntrinsicType) UserType(com.robotoworks.mechanoid.net.netModel.UserType) GenericListType(com.robotoworks.mechanoid.net.netModel.GenericListType) GenericListType(com.robotoworks.mechanoid.net.netModel.GenericListType) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Aggregations

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