@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();
oprot.writeSetBegin(new TSet(mt.getType(),set.size()));
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();
}