private static List<?> serializeStruct(Object obj, StructObjectInspector soi)
    throws SerDeException {

    List<? extends StructField> fields = soi.getAllStructFieldRefs();
    List<Object> list = soi.getStructFieldsDataAsList(obj);

    if (list == null) {
      return null;
    }

    List<Object> l = new ArrayList<Object>(fields.size());

    if (fields != null) {
      for (int i = 0; i < fields.size(); i++) {

        // Get the field objectInspector and the field object.
        ObjectInspector foi = fields.get(i).getFieldObjectInspector();
        Object f = list.get(i);
        Object res = serializeField(f, foi);
        l.add(i, res);
      }
    }
    return l;
  }
Return serialized HCatRecord from an underlying
object-representation, and readable by an ObjectInspector
@param obj : Underlying object-representation
@param soi : StructObjectInspector
@return HCatRecord
hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/HCatRecordSerDe.java