Search in sources :

Example 6 with Type

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

the class EntityGenerator method _generateGetterAndSetter.

protected CharSequence _generateGetterAndSetter(final TypedMember member) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("public ");
    Type _type = member.getType();
    String _signature = ModelExtensions.signature(_type);
    _builder.append(_signature, "");
    _builder.append(" ");
    String _getMethodName = ModelExtensions.toGetMethodName(member);
    _builder.append(_getMethodName, "");
    _builder.append("(){");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("return ");
    String _identifier = ModelExtensions.toIdentifier(member);
    _builder.append(_identifier, "\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_1 = member.getType();
    String _signature_1 = ModelExtensions.signature(_type_1);
    _builder.append(_signature_1, "");
    _builder.append(" value){");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("this.");
    String _identifier_1 = ModelExtensions.toIdentifier(member);
    _builder.append(_identifier_1, "\t");
    _builder.append(" = value;");
    _builder.newLineIfNotEmpty();
    _builder.append("}");
    _builder.newLine();
    return _builder;
}
Also used : Type(com.robotoworks.mechanoid.net.netModel.Type) GenericListType(com.robotoworks.mechanoid.net.netModel.GenericListType) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 7 with Type

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

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

the class TypedMemberImpl method basicSetType.

/**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
public NotificationChain basicSetType(Type newType, NotificationChain msgs) {
    Type oldType = type;
    type = newType;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, NetModelPackage.TYPED_MEMBER__TYPE, oldType, newType);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : Type(com.robotoworks.mechanoid.net.netModel.Type) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 9 with Type

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

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

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