@Override
public void serialize(Object o, ObjectInspector oi, TProtocol oprot)
throws TException, SerDeException, NoSuchFieldException, IllegalAccessException {
ListObjectInspector loi = (ListObjectInspector) oi;
Set<Object> set = (Set<Object>) o;
DynamicSerDeTypeBase mt = getElementType();
tset = new TSet(mt.getType(), set.size());
oprot.writeSetBegin(tset);
for (Object element : set) {
mt.serialize(element, loi.getListElementObjectInspector(), oprot);
}
// in theory, the below call isn't needed in non thrift_mode, but let's not
// get too crazy
oprot.writeSetEnd();
}