Search in sources :

Example 1 with SkipMember

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

the class ResultGenerator method _generateBaseAccessor.

protected CharSequence _generateBaseAccessor(final SkipMember member) {
    StringConcatenation _builder = new StringConcatenation();
    ComplexTypeLiteral _literal = member.getLiteral();
    EList<Member> _members = _literal.getMembers();
    Object _generateBaseAccessors = this.generateBaseAccessors(_members);
    _builder.append(_generateBaseAccessors, "");
    _builder.newLineIfNotEmpty();
    return _builder;
}
Also used : 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)

Example 2 with SkipMember

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

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

the class JsonWriterStatementGenerator method _genStatement.

protected CharSequence _genStatement(final SkipMember skipMember) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.newLine();
    _builder.append("\t");
    String _writerIdentifier = this.getWriterIdentifier();
    _builder.append(_writerIdentifier, "\t");
    _builder.append(".name(\"");
    String _name = skipMember.getName();
    _builder.append(_name, "\t");
    _builder.append("\");");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.newLine();
    _builder.append("\t");
    ComplexTypeLiteral _literal = skipMember.getLiteral();
    EList<Member> _members = _literal.getMembers();
    Object _genWriteComplexTypeLiteralForMembers = this.genWriteComplexTypeLiteralForMembers(_members);
    _builder.append(_genWriteComplexTypeLiteralForMembers, "\t");
    _builder.newLineIfNotEmpty();
    return _builder;
}
Also used : 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)

Example 4 with SkipMember

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

Aggregations

ComplexTypeLiteral (com.robotoworks.mechanoid.net.netModel.ComplexTypeLiteral)4 Member (com.robotoworks.mechanoid.net.netModel.Member)4 SkipMember (com.robotoworks.mechanoid.net.netModel.SkipMember)4 TypedMember (com.robotoworks.mechanoid.net.netModel.TypedMember)4 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)3 ImportHelper (com.robotoworks.mechanoid.net.generator.ImportHelper)1 BlockType (com.robotoworks.mechanoid.net.netModel.BlockType)1 GenericListType (com.robotoworks.mechanoid.net.netModel.GenericListType)1 IntrinsicType (com.robotoworks.mechanoid.net.netModel.IntrinsicType)1 SimpleMember (com.robotoworks.mechanoid.net.netModel.SimpleMember)1 StringType (com.robotoworks.mechanoid.net.netModel.StringType)1 Type (com.robotoworks.mechanoid.net.netModel.Type)1 UserType (com.robotoworks.mechanoid.net.netModel.UserType)1 EList (org.eclipse.emf.common.util.EList)1