You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BackBufferSimpleSerializer.java 721B

123456789101112131415161718192021222324
  1. package com.dmdirc.addons.ui_web2.serialisers;
  2. import com.dmdirc.ui.messages.BackBuffer;
  3. import com.google.gson.JsonElement;
  4. import com.google.gson.JsonObject;
  5. import com.google.gson.JsonSerializationContext;
  6. import com.google.gson.JsonSerializer;
  7. import java.lang.reflect.Type;
  8. /**
  9. * Serializes a {@link BackBuffer} without including the full content.
  10. */
  11. public class BackBufferSimpleSerializer implements JsonSerializer<BackBuffer> {
  12. @Override
  13. public JsonElement serialize(final BackBuffer src, final Type typeOfSrc, final JsonSerializationContext context) {
  14. final JsonObject res = new JsonObject();
  15. res.addProperty("lines", src.getDocument().getNumLines());
  16. return res;
  17. }
  18. }