public final void internalToString(final StringBuilder repr, final String prefix) {
   repr.append(prefix).append("contents=");
   if (this.contents.isEmpty()) {
     repr.append("{}").append('\n');
   } else {
     repr.append("(").append(this.contents.size()).append(" elements)...\n");
     for (int i = 0; i < this.contents.size(); ++i) {
       final Content contents_element = this.contents.get(i);
       contents_element.internalToString(repr, prefix + i + "/ ");
     }
   }
   repr.append(prefix).append("contentsSelection=");
   if (this.contentsSelection == null) {
     repr.append("{}").append('\n');
   } else {
     repr.append("...\n");
     this.contentsSelection.internalToString(repr, prefix + "  ");
   }
   repr.append(prefix).append("buyableContents=");
   if (this.buyableContents.isEmpty()) {
     repr.append("{}").append('\n');
   } else {
     repr.append("(").append(this.buyableContents.size()).append(" elements)...\n");
     for (int i = 0; i < this.buyableContents.size(); ++i) {
       final BuyableContent buyableContents_element = this.buyableContents.get(i);
       buyableContents_element.internalToString(repr, prefix + i + "/ ");
     }
   }
 }
 @Override
 public boolean serialize(final ByteBuffer buffer) {
   if (this.contents.size() > 65535) {
     return false;
   }
   buffer.putShort((short) this.contents.size());
   for (int i = 0; i < this.contents.size(); ++i) {
     final Content contents_element = this.contents.get(i);
     final boolean contents_element_ok = contents_element.serialize(buffer);
     if (!contents_element_ok) {
       return false;
     }
   }
   if (this.contentsSelection != null) {
     buffer.put((byte) 1);
     final boolean contentsSelection_ok = this.contentsSelection.serialize(buffer);
     if (!contentsSelection_ok) {
       return false;
     }
   } else {
     buffer.put((byte) 0);
   }
   if (this.buyableContents.size() > 65535) {
     return false;
   }
   buffer.putShort((short) this.buyableContents.size());
   for (int i = 0; i < this.buyableContents.size(); ++i) {
     final BuyableContent buyableContents_element = this.buyableContents.get(i);
     final boolean buyableContents_element_ok = buyableContents_element.serialize(buffer);
     if (!buyableContents_element_ok) {
       return false;
     }
   }
   return true;
 }
 @Override
 public int serializedSize() {
   int size = 0;
   size += 2;
   for (int i = 0; i < this.contents.size(); ++i) {
     final Content contents_element = this.contents.get(i);
     size += contents_element.serializedSize();
   }
   ++size;
   if (this.contentsSelection != null) {
     size += this.contentsSelection.serializedSize();
   }
   size += 2;
   for (int i = 0; i < this.buyableContents.size(); ++i) {
     final BuyableContent buyableContents_element = this.buyableContents.get(i);
     size += buyableContents_element.serializedSize();
   }
   return size;
 }
 @Override
 public boolean unserialize(final ByteBuffer buffer) {
   final int contents_size = buffer.getShort() & 0xFFFF;
   this.contents.clear();
   this.contents.ensureCapacity(contents_size);
   for (int i = 0; i < contents_size; ++i) {
     final Content contents_element = new Content();
     final boolean contents_element_ok = contents_element.unserialize(buffer);
     if (!contents_element_ok) {
       return false;
     }
     this.contents.add(contents_element);
   }
   final boolean contentsSelection_present = buffer.get() == 1;
   if (contentsSelection_present) {
     this.contentsSelection = new ContentsSelection();
     final boolean contentsSelection_ok = this.contentsSelection.unserialize(buffer);
     if (!contentsSelection_ok) {
       return false;
     }
   } else {
     this.contentsSelection = null;
   }
   final int buyableContents_size = buffer.getShort() & 0xFFFF;
   this.buyableContents.clear();
   this.buyableContents.ensureCapacity(buyableContents_size);
   for (int j = 0; j < buyableContents_size; ++j) {
     final BuyableContent buyableContents_element = new BuyableContent();
     final boolean buyableContents_element_ok = buyableContents_element.unserialize(buffer);
     if (!buyableContents_element_ok) {
       return false;
     }
     this.buyableContents.add(buyableContents_element);
   }
   return true;
 }