protected CharSequence _generateDeserializationStatementForUserType( final ResponseBlock response, final UserType type, final ComplexTypeDeclaration declaration) { StringConcatenation _builder = new StringConcatenation(); CharSequence _generateDeserializationStatementHeader = this.generateDeserializationStatementHeader(true); _builder.append(_generateDeserializationStatementHeader, ""); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("this."); String _signature = ModelExtensions.signature(type); String _camelize = Strings.camelize(_signature); _builder.append(_camelize, "\t\t"); _builder.append(" = new "); String _signature_1 = ModelExtensions.signature(type); _builder.append(_signature_1, "\t\t"); _builder.append("();"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("provider.get("); String _signature_2 = ModelExtensions.signature(type); _builder.append(_signature_2, "\t\t"); _builder.append(".class).read(reader, this."); String _signature_3 = ModelExtensions.signature(type); String _camelize_1 = Strings.camelize(_signature_3); _builder.append(_camelize_1, "\t\t"); _builder.append(");"); _builder.newLineIfNotEmpty(); CharSequence _generateDeserializationStatementFooter = this.generateDeserializationStatementFooter(true); _builder.append(_generateDeserializationStatementFooter, ""); _builder.newLineIfNotEmpty(); return _builder; }
protected CharSequence _generateDeserializationStatementForUserType( final ResponseBlock response, final UserType type, final EnumTypeDeclaration declaration) { StringConcatenation _builder = new StringConcatenation(); this.imports.addImport("com.robotoworks.mechanoid.util.Streams"); _builder.newLineIfNotEmpty(); CharSequence _generateDeserializationStatementHeader = this.generateDeserializationStatementHeader(false); _builder.append(_generateDeserializationStatementHeader, ""); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("String source = Streams.readAllText(inStream);"); _builder.newLine(); _builder.append("\t\t"); _builder.append("this."); String _signature = ModelExtensions.signature(type); String _camelize = Strings.camelize(_signature); _builder.append(_camelize, "\t\t"); _builder.append(" = "); String _signature_1 = ModelExtensions.signature(type); _builder.append(_signature_1, "\t\t"); _builder.append(".fromValue(source);"); _builder.newLineIfNotEmpty(); CharSequence _generateDeserializationStatementFooter = this.generateDeserializationStatementFooter(false); _builder.append(_generateDeserializationStatementFooter, ""); _builder.newLineIfNotEmpty(); return _builder; }
protected CharSequence _generateFieldForType(final GenericListType type) { StringConcatenation _builder = new StringConcatenation(); { Type _elementType = type.getElementType(); if ((_elementType instanceof IntrinsicType)) { _builder.append("private "); String _signature = ModelExtensions.signature(type); _builder.append(_signature, ""); _builder.append(" values;"); _builder.newLineIfNotEmpty(); } else { _builder.append("private "); String _signature_1 = ModelExtensions.signature(type); _builder.append(_signature_1, ""); _builder.append(" "); String _innerSignature = ModelExtensions.innerSignature(type); String _camelize = Strings.camelize(_innerSignature); String _pluralize = Strings.pluralize(_camelize); _builder.append(_pluralize, ""); _builder.append(";"); _builder.newLineIfNotEmpty(); } } return _builder; }
protected CharSequence _generateFieldForType(final UserType type) { StringConcatenation _builder = new StringConcatenation(); _builder.append("private "); String _signature = ModelExtensions.signature(type); _builder.append(_signature, ""); _builder.append(" "); String _signature_1 = ModelExtensions.signature(type); String _camelize = Strings.camelize(_signature_1); String _escapeReserved = ModelExtensions.escapeReserved(_camelize); _builder.append(_escapeReserved, ""); _builder.append(";"); _builder.newLineIfNotEmpty(); return _builder; }
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; }
protected CharSequence _generateFieldForType(final IntrinsicType type) { StringConcatenation _builder = new StringConcatenation(); _builder.append("private "); String _signature = ModelExtensions.signature(type); _builder.append(_signature, ""); _builder.append(" value;\t"); _builder.newLineIfNotEmpty(); return _builder; }
protected CharSequence _generateGetterForType(final GenericListType type) { StringConcatenation _builder = new StringConcatenation(); { Type _elementType = type.getElementType(); if ((_elementType instanceof IntrinsicType)) { _builder.append("public "); String _signature = ModelExtensions.signature(type); _builder.append(_signature, ""); _builder.append(" getValues(){"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("return this.values;"); _builder.newLine(); _builder.append("}"); _builder.newLine(); } else { _builder.append("public "); String _signature_1 = ModelExtensions.signature(type); _builder.append(_signature_1, ""); _builder.append(" get"); String _innerSignature = ModelExtensions.innerSignature(type); String _pascalize = Strings.pascalize(_innerSignature); String _pluralize = Strings.pluralize(_pascalize); _builder.append(_pluralize, ""); _builder.append("(){"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("return this."); String _innerSignature_1 = ModelExtensions.innerSignature(type); String _camelize = Strings.camelize(_innerSignature_1); String _pluralize_1 = Strings.pluralize(_camelize); _builder.append(_pluralize_1, "\t"); _builder.append(";"); _builder.newLineIfNotEmpty(); _builder.append("}"); _builder.newLine(); } } return _builder; }
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; }
protected CharSequence _generateGetter(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 this."); 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; }
protected CharSequence _generateGetterForType(final UserType type) { StringConcatenation _builder = new StringConcatenation(); _builder.append("public "); String _signature = ModelExtensions.signature(type); _builder.append(_signature, ""); _builder.append(" get"); String _signature_1 = ModelExtensions.signature(type); String _pascalize = Strings.pascalize(_signature_1); _builder.append(_pascalize, ""); _builder.append("(){"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("return this."); String _signature_2 = ModelExtensions.signature(type); String _camelize = Strings.camelize(_signature_2); String _escapeReserved = ModelExtensions.escapeReserved(_camelize); _builder.append(_escapeReserved, "\t"); _builder.append(";"); _builder.newLineIfNotEmpty(); _builder.append("}"); _builder.newLine(); return _builder; }
protected CharSequence _generateGetterForType(final IntrinsicType type) { StringConcatenation _builder = new StringConcatenation(); _builder.append("public "); String _signature = ModelExtensions.signature(type); _builder.append(_signature, ""); _builder.append(" getValue(){"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("return this.value;"); _builder.newLine(); _builder.append("}"); _builder.newLine(); return _builder; }
protected CharSequence _generateDeserializationStatementForUserTypeGenericList( final ResponseBlock response, final GenericListType type, final UserType genericType, final EnumTypeDeclaration declaration) { StringConcatenation _builder = new StringConcatenation(); this.imports.addImport("com.robotoworks.mechanoid.internal.util.JsonToken"); _builder.newLineIfNotEmpty(); this.imports.addImport("java.util.ArrayList"); _builder.newLineIfNotEmpty(); this.imports.addImport("java.util.List"); _builder.newLineIfNotEmpty(); CharSequence _generateDeserializationStatementHeader = this.generateDeserializationStatementHeader(true); _builder.append(_generateDeserializationStatementHeader, ""); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("this."); String _innerSignature = ModelExtensions.innerSignature(type); String _camelize = Strings.camelize(_innerSignature); String _pluralize = Strings.pluralize(_camelize); _builder.append(_pluralize, "\t\t"); _builder.append(" = new Array"); String _signature = ModelExtensions.signature(type); _builder.append(_signature, "\t\t"); _builder.append("();"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("if(reader.peek() != JsonToken.NULL) {"); _builder.newLine(); _builder.append("\t\t\t"); _builder.newLine(); _builder.append("\t\t\t"); _builder.append("reader.beginArray();"); _builder.newLine(); _builder.append("\t\t\t"); _builder.newLine(); _builder.append("\t\t\t"); _builder.append("while(reader.hasNext()) {"); _builder.newLine(); _builder.append("\t\t\t\t"); String _innerSignature_1 = ModelExtensions.innerSignature(type); _builder.append(_innerSignature_1, "\t\t\t\t"); _builder.append(" element = "); String _innerSignature_2 = ModelExtensions.innerSignature(type); _builder.append(_innerSignature_2, "\t\t\t\t"); _builder.append(".fromValue(reader."); String _resolveJsonReaderMethodName = ModelExtensions.resolveJsonReaderMethodName(declaration); _builder.append(_resolveJsonReaderMethodName, "\t\t\t\t"); _builder.append("());"); _builder.newLineIfNotEmpty(); _builder.append("\t\t\t\t"); _builder.append("this."); String _innerSignature_3 = ModelExtensions.innerSignature(type); String _camelize_1 = Strings.camelize(_innerSignature_3); String _pluralize_1 = Strings.pluralize(_camelize_1); _builder.append(_pluralize_1, "\t\t\t\t"); _builder.append(".add(element);"); _builder.newLineIfNotEmpty(); _builder.append("\t\t\t"); _builder.append("}"); _builder.newLine(); _builder.append("\t\t\t"); _builder.newLine(); _builder.append("\t\t\t"); _builder.append("reader.endArray();"); _builder.newLine(); _builder.append("\t\t"); _builder.append("}"); _builder.newLine(); CharSequence _generateDeserializationStatementFooter = this.generateDeserializationStatementFooter(true); _builder.append(_generateDeserializationStatementFooter, ""); _builder.newLineIfNotEmpty(); return _builder; }