Esempio n. 1
0
 protected CharSequence _generateDeserializationStatementForType(
     final ResponseBlock response, final IntrinsicType type) {
   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.newLine();
   _builder.append("\t\t");
   _builder.append("this.value = ");
   String _boxedTypeSignature = ModelExtensions.getBoxedTypeSignature(type);
   _builder.append(_boxedTypeSignature, "\t\t");
   _builder.append(".valueOf(source);");
   _builder.newLineIfNotEmpty();
   CharSequence _generateDeserializationStatementFooter =
       this.generateDeserializationStatementFooter(false);
   _builder.append(_generateDeserializationStatementFooter, "");
   _builder.newLineIfNotEmpty();
   return _builder;
 }
Esempio n. 2
0
 protected CharSequence _generateDeserializationStatementForGenericListType(
     final ResponseBlock response, final GenericListType type, final IntrinsicType genericType) {
   StringConcatenation _builder = new StringConcatenation();
   this.imports.addImport("com.robotoworks.mechanoid.internal.util.JsonUtil");
   _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.values = JsonUtil.read");
   String _boxedTypeSignature = ModelExtensions.getBoxedTypeSignature(genericType);
   _builder.append(_boxedTypeSignature, "\t\t");
   _builder.append("List(reader);");
   _builder.newLineIfNotEmpty();
   CharSequence _generateDeserializationStatementFooter =
       this.generateDeserializationStatementFooter(true);
   _builder.append(_generateDeserializationStatementFooter, "");
   _builder.newLineIfNotEmpty();
   return _builder;
 }