Search in sources :

Example 6 with ComplexTypeLiteral

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

the class JsonReaderStatementGenerator method _genStatement.

protected CharSequence _genStatement(final SkipMember skipMember) {
    StringConcatenation _builder = new StringConcatenation();
    ImportHelper _imports = this.getImports();
    _imports.addImport("com.robotoworks.mechanoid.internal.util.JsonToken");
    _builder.newLineIfNotEmpty();
    String _readerIdentifier = this.getReaderIdentifier();
    _builder.append(_readerIdentifier, "");
    _builder.append(".beginObject();");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("while(");
    String _readerIdentifier_1 = this.getReaderIdentifier();
    _builder.append(_readerIdentifier_1, "");
    _builder.append(".hasNext()) {");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("name = ");
    String _readerIdentifier_2 = this.getReaderIdentifier();
    _builder.append(_readerIdentifier_2, "\t");
    _builder.append(".nextName();");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("if(");
    String _readerIdentifier_3 = this.getReaderIdentifier();
    _builder.append(_readerIdentifier_3, "\t");
    _builder.append(".peek() == JsonToken.NULL) {");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    String _readerIdentifier_4 = this.getReaderIdentifier();
    _builder.append(_readerIdentifier_4, "\t\t");
    _builder.append(".skipValue();");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("continue;");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.newLine();
    _builder.append("\t");
    int COUNTER = 0;
    _builder.newLineIfNotEmpty();
    {
        ComplexTypeLiteral _literal = skipMember.getLiteral();
        EList<Member> _members = _literal.getMembers();
        for (final Member member : _members) {
            _builder.append("\t");
            Object _genBlock = this.genBlock(member, COUNTER = (COUNTER + 1));
            _builder.append(_genBlock, "\t");
            _builder.newLineIfNotEmpty();
        }
    }
    {
        if ((COUNTER > 0)) {
            _builder.append("\t");
            _builder.append("else {");
            _builder.newLine();
            _builder.append("\t");
            _builder.append("\t");
            String _readerIdentifier_5 = this.getReaderIdentifier();
            _builder.append(_readerIdentifier_5, "\t\t");
            _builder.append(".skipValue();");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append("}");
            _builder.newLine();
        }
    }
    _builder.append("}");
    _builder.newLine();
    _builder.newLine();
    String _readerIdentifier_6 = this.getReaderIdentifier();
    _builder.append(_readerIdentifier_6, "");
    _builder.append(".endObject();");
    _builder.newLineIfNotEmpty();
    return _builder;
}
Also used : EList(org.eclipse.emf.common.util.EList) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) ComplexTypeLiteral(com.robotoworks.mechanoid.net.netModel.ComplexTypeLiteral) TypedMember(com.robotoworks.mechanoid.net.netModel.TypedMember) Member(com.robotoworks.mechanoid.net.netModel.Member) SkipMember(com.robotoworks.mechanoid.net.netModel.SkipMember) ImportHelper(com.robotoworks.mechanoid.net.generator.ImportHelper)

Example 7 with ComplexTypeLiteral

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

the class ComplexTypeDeclarationImpl method basicSetLiteral.

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

Example 8 with ComplexTypeLiteral

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

the class SkipMemberImpl method basicSetLiteral.

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

Example 9 with ComplexTypeLiteral

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

the class ResultGenerator method _generateGetter.

protected CharSequence _generateGetter(final SkipMember member) {
    StringConcatenation _builder = new StringConcatenation();
    ComplexTypeLiteral _literal = member.getLiteral();
    Object _generateGetterForType = this.generateGetterForType(_literal);
    _builder.append(_generateGetterForType, "");
    _builder.newLineIfNotEmpty();
    return _builder;
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) ComplexTypeLiteral(com.robotoworks.mechanoid.net.netModel.ComplexTypeLiteral)

Example 10 with ComplexTypeLiteral

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

the class ResultGenerator method _generateFieldForMember.

protected CharSequence _generateFieldForMember(final SkipMember member) {
    StringConcatenation _builder = new StringConcatenation();
    ComplexTypeLiteral _literal = member.getLiteral();
    Object _generateFieldForType = this.generateFieldForType(_literal);
    _builder.append(_generateFieldForType, "");
    _builder.newLineIfNotEmpty();
    return _builder;
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) ComplexTypeLiteral(com.robotoworks.mechanoid.net.netModel.ComplexTypeLiteral)

Aggregations

ComplexTypeLiteral (com.robotoworks.mechanoid.net.netModel.ComplexTypeLiteral)13 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)10 Member (com.robotoworks.mechanoid.net.netModel.Member)6 SkipMember (com.robotoworks.mechanoid.net.netModel.SkipMember)6 TypedMember (com.robotoworks.mechanoid.net.netModel.TypedMember)6 EList (org.eclipse.emf.common.util.EList)3 BlockType (com.robotoworks.mechanoid.net.netModel.BlockType)2 GenericListType (com.robotoworks.mechanoid.net.netModel.GenericListType)2 IntrinsicType (com.robotoworks.mechanoid.net.netModel.IntrinsicType)2 Type (com.robotoworks.mechanoid.net.netModel.Type)2 UserType (com.robotoworks.mechanoid.net.netModel.UserType)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 ResponseBlock (com.robotoworks.mechanoid.net.netModel.ResponseBlock)1 SimpleMember (com.robotoworks.mechanoid.net.netModel.SimpleMember)1 StringType (com.robotoworks.mechanoid.net.netModel.StringType)1 BasicEList (org.eclipse.emf.common.util.BasicEList)1 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)1