コード例 #1
0
 public void Write(TProtocol oprot)
 {
     oprot.IncrementRecursionDepth();
     try
     {
         TStruct struc = new TStruct("Address");
         oprot.WriteStructBegin(struc);
         TField field = new TField();
         if (__isset.id)
         {
             field.Name = "id";
             field.Type = TType.I32;
             field.ID   = 1;
             oprot.WriteFieldBegin(field);
             oprot.WriteI32(Id);
             oprot.WriteFieldEnd();
         }
         if (City != null && __isset.city)
         {
             field.Name = "city";
             field.Type = TType.Struct;
             field.ID   = 2;
             oprot.WriteFieldBegin(field);
             City.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (County != null && __isset.county)
         {
             field.Name = "county";
             field.Type = TType.Struct;
             field.ID   = 3;
             oprot.WriteFieldBegin(field);
             County.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (Country != null && __isset.country)
         {
             field.Name = "country";
             field.Type = TType.Struct;
             field.ID   = 4;
             oprot.WriteFieldBegin(field);
             Country.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (Details != null && __isset.details)
         {
             field.Name = "details";
             field.Type = TType.String;
             field.ID   = 5;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(Details);
             oprot.WriteFieldEnd();
         }
         if (PostalCode != null && __isset.postalCode)
         {
             field.Name = "postalCode";
             field.Type = TType.String;
             field.ID   = 6;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(PostalCode);
             oprot.WriteFieldEnd();
         }
         oprot.WriteFieldStop();
         oprot.WriteStructEnd();
     }
     finally
     {
         oprot.DecrementRecursionDepth();
     }
 }
コード例 #2
0
        public override string ToString()
        {
            StringBuilder __sb    = new StringBuilder("Address(");
            bool          __first = true;

            if (__isset.id)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Id: ");
                __sb.Append(Id);
            }
            if (City != null && __isset.city)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("City: ");
                __sb.Append(City == null ? "<null>" : City.ToString());
            }
            if (County != null && __isset.county)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("County: ");
                __sb.Append(County == null ? "<null>" : County.ToString());
            }
            if (Country != null && __isset.country)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Country: ");
                __sb.Append(Country == null ? "<null>" : Country.ToString());
            }
            if (Details != null && __isset.details)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Details: ");
                __sb.Append(Details);
            }
            if (PostalCode != null && __isset.postalCode)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("PostalCode: ");
                __sb.Append(PostalCode);
            }
            __sb.Append(")");
            return(__sb.ToString());
        }
コード例 #3
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.I32)
                        {
                            Id = iprot.ReadI32();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.Struct)
                        {
                            City = new City();
                            City.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Struct)
                        {
                            County = new County();
                            County.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.Struct)
                        {
                            Country = new Country();
                            Country.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.String)
                        {
                            Details = iprot.ReadString();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 6:
                        if (field.Type == TType.String)
                        {
                            PostalCode = iprot.ReadString();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }