@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 = this.getElementType();
tset.elemType = mt.getType();
tset.size = 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();
}