Search in sources :

Example 11 with Type

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

the class RequestGenerator method _buildConstructorArgsForType.

protected void _buildConstructorArgsForType(final ComplexTypeLiteral type, final List<String> args) {
    EList<Member> _members = type.getMembers();
    for (final Member member : _members) {
        if ((member instanceof TypedMember)) {
            Type _type = ((TypedMember) member).getType();
            String _signature = ModelExtensions.signature(_type);
            String _plus = (_signature + " ");
            String _identifier = ModelExtensions.toIdentifier(member);
            String _plus_1 = (_plus + _identifier);
            args.add(_plus_1);
        } else {
            if ((member instanceof SkipMember)) {
                ComplexTypeLiteral _literal = ((SkipMember) member).getLiteral();
                this.buildConstructorArgsForType(_literal, args);
            }
        }
    }
}
Also used : 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) TypedMember(com.robotoworks.mechanoid.net.netModel.TypedMember) TypedMember(com.robotoworks.mechanoid.net.netModel.TypedMember) SimpleMember(com.robotoworks.mechanoid.net.netModel.SimpleMember) Member(com.robotoworks.mechanoid.net.netModel.Member) SkipMember(com.robotoworks.mechanoid.net.netModel.SkipMember) ComplexTypeLiteral(com.robotoworks.mechanoid.net.netModel.ComplexTypeLiteral) SkipMember(com.robotoworks.mechanoid.net.netModel.SkipMember)

Example 12 with Type

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

the class NetModelLabelProvider method text.

String text(HttpMethod ele) {
    ResponseBlock block = ModelExtensions.getResponseBlock(ele);
    String name = ele.getName();
    name += " " + serializer.serialize(ele.getPath()).replaceAll("([a-zA-Z0-9_\\^]+):[a-zA-Z0-9_\\^]+", "{$1}");
    if (block != null && block.getType() instanceof Type) {
        if (block.getType() instanceof Type) {
            name += " : " + ModelExtensions.signature((Type) block.getType());
        }
    }
    return name;
}
Also used : Type(com.robotoworks.mechanoid.net.netModel.Type) ResponseBlock(com.robotoworks.mechanoid.net.netModel.ResponseBlock)

Example 13 with Type

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

Example 14 with Type

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

the class ResultGenerator method _generateFieldForMember.

protected CharSequence _generateFieldForMember(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();
    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) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Aggregations

Type (com.robotoworks.mechanoid.net.netModel.Type)14 GenericListType (com.robotoworks.mechanoid.net.netModel.GenericListType)12 IntrinsicType (com.robotoworks.mechanoid.net.netModel.IntrinsicType)9 UserType (com.robotoworks.mechanoid.net.netModel.UserType)9 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)9 BlockType (com.robotoworks.mechanoid.net.netModel.BlockType)8 StringType (com.robotoworks.mechanoid.net.netModel.StringType)4 ComplexTypeLiteral (com.robotoworks.mechanoid.net.netModel.ComplexTypeLiteral)2 Member (com.robotoworks.mechanoid.net.netModel.Member)2 ResponseBlock (com.robotoworks.mechanoid.net.netModel.ResponseBlock)2 SkipMember (com.robotoworks.mechanoid.net.netModel.SkipMember)2 TypedMember (com.robotoworks.mechanoid.net.netModel.TypedMember)2 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)2 ImportHelper (com.robotoworks.mechanoid.net.generator.ImportHelper)1 ComplexTypeDeclaration (com.robotoworks.mechanoid.net.netModel.ComplexTypeDeclaration)1 SimpleMember (com.robotoworks.mechanoid.net.netModel.SimpleMember)1 BasicEList (org.eclipse.emf.common.util.BasicEList)1 EList (org.eclipse.emf.common.util.EList)1 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)1