Example #1
0
        public void mergeFrom(Input input, DVTEXT message) throws IOException {
          for (int number = input.readFieldNumber(this); ; number = input.readFieldNumber(this)) {
            switch (number) {
              case 0:
                return;
              case 1:
                message.value = input.readString();
                break;
              case 2:
                message.hyperlink = input.mergeObject(message.hyperlink, DVURI.getSchema());
                break;

              case 3:
                message.formatting = input.readString();
                break;
              case 4:
                if (message.mappings == null) message.mappings = new ArrayList<TERMMAPPING>();
                message.mappings.add(input.mergeObject(null, TERMMAPPING.getSchema()));
                break;

              case 5:
                message.language = input.mergeObject(message.language, CODEPHRASE.getSchema());
                break;

              case 6:
                message.encoding = input.mergeObject(message.encoding, CODEPHRASE.getSchema());
                break;

              default:
                input.handleUnknownField(number, this);
            }
          }
        }
Example #2
0
        public void writeTo(Output output, DVTEXT message) throws IOException {
          if (message.value == null) throw new UninitializedMessageException(message);
          output.writeString(1, message.value, false);

          if (message.hyperlink != null)
            output.writeObject(2, message.hyperlink, DVURI.getSchema(), false);

          if (message.formatting != null) output.writeString(3, message.formatting, false);

          if (message.mappings != null) {
            for (TERMMAPPING mappings : message.mappings) {
              if (mappings != null) output.writeObject(4, mappings, TERMMAPPING.getSchema(), true);
            }
          }

          if (message.language != null)
            output.writeObject(5, message.language, CODEPHRASE.getSchema(), false);

          if (message.encoding != null)
            output.writeObject(6, message.encoding, CODEPHRASE.getSchema(), false);
        }