Package tenapull.data.deserialize
Class Lists.SortSerializer<T extends java.lang.Comparable>
java.lang.Object
com.fasterxml.jackson.databind.JsonSerializer<java.util.List<T>>
tenapull.data.deserialize.Lists.SortSerializer<T>
- Type Parameters:
T-
- All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable
- Enclosing class:
- Lists
public static class Lists.SortSerializer<T extends java.lang.Comparable>
extends com.fasterxml.jackson.databind.JsonSerializer<java.util.List<T>>
Serializer which sorts a list of Comparables before serializing it
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor Description SortSerializer() -
Method Summary
Modifier and Type Method Description voidserialize(java.util.List<T> list, com.fasterxml.jackson.core.JsonGenerator jg, com.fasterxml.jackson.databind.SerializerProvider sp)Takes a list of objects implementing the Comparable interface, sorts them using Collections.sort(list), and then serializes them normally
-
Constructor Details
-
SortSerializer
public SortSerializer()
-
-
Method Details
-
serialize
public void serialize(java.util.List<T> list, com.fasterxml.jackson.core.JsonGenerator jg, com.fasterxml.jackson.databind.SerializerProvider sp) throws java.io.IOExceptionTakes a list of objects implementing the Comparable interface, sorts them using Collections.sort(list), and then serializes them normally- Specified by:
serializein classcom.fasterxml.jackson.databind.JsonSerializer<java.util.List<T extends java.lang.Comparable>>- Parameters:
list-jg-sp-- Throws:
java.io.IOException
-