/*
 * Copyright 2024 CloudWeGo Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Code generated by thriftgo (0.3.18). DO NOT EDIT.

package baseline

import (
	"database/sql"
	"database/sql/driver"
	"fmt"
	"github.com/apache/thrift/lib/go/thrift"
	"reflect"
)

type Enums int64

const (
	Enums_ValueA Enums = 0
	Enums_ValueB Enums = 1
	Enums_ValueC Enums = 2
)

func (p Enums) String() string {
	switch p {
	case Enums_ValueA:
		return "ValueA"
	case Enums_ValueB:
		return "ValueB"
	case Enums_ValueC:
		return "ValueC"
	}
	return "<UNSET>"
}

func EnumsFromString(s string) (Enums, error) {
	switch s {
	case "ValueA":
		return Enums_ValueA, nil
	case "ValueB":
		return Enums_ValueB, nil
	case "ValueC":
		return Enums_ValueC, nil
	}
	return Enums(0), fmt.Errorf("not a valid Enums string")
}

func EnumsPtr(v Enums) *Enums { return &v }
func (p *Enums) Scan(value interface{}) (err error) {
	var result sql.NullInt64
	err = result.Scan(value)
	*p = Enums(result.Int64)
	return
}

func (p *Enums) Value() (driver.Value, error) {
	if p == nil {
		return nil, nil
	}
	return int64(*p), nil
}

type Simple struct {
	ByteField   int8    `thrift:"ByteField,1" frugal:"1,default,byte" json:"ByteField"`
	I64Field    int64   `thrift:"I64Field,2" frugal:"2,default,i64" json:"I64Field"`
	DoubleField float64 `thrift:"DoubleField,3" frugal:"3,default,double" json:"DoubleField"`
	I32Field    int32   `thrift:"I32Field,4" frugal:"4,default,i32" json:"I32Field"`
	StringField string  `thrift:"StringField,5" frugal:"5,default,string" json:"StringField"`
	BinaryField []byte  `thrift:"BinaryField,6" frugal:"6,default,binary" json:"BinaryField"`
	EnumField   Enums   `thrift:"enumField,7" frugal:"7,default,Enums" json:"enumField"`
}

func NewSimple() *Simple {
	return &Simple{}
}

func (p *Simple) InitDefault() {
}

func (p *Simple) GetByteField() (v int8) {
	return p.ByteField
}

func (p *Simple) GetI64Field() (v int64) {
	return p.I64Field
}

func (p *Simple) GetDoubleField() (v float64) {
	return p.DoubleField
}

func (p *Simple) GetI32Field() (v int32) {
	return p.I32Field
}

func (p *Simple) GetStringField() (v string) {
	return p.StringField
}

func (p *Simple) GetBinaryField() (v []byte) {
	return p.BinaryField
}

func (p *Simple) GetEnumField() (v Enums) {
	return p.EnumField
}

var fieldIDToName_Simple = map[int16]string{
	1: "ByteField",
	2: "I64Field",
	3: "DoubleField",
	4: "I32Field",
	5: "StringField",
	6: "BinaryField",
	7: "enumField",
}

func (p *Simple) Read(iprot thrift.TProtocol) (err error) {

	var fieldTypeId thrift.TType
	var fieldId int16

	if _, err = iprot.ReadStructBegin(); err != nil {
		goto ReadStructBeginError
	}

	for {
		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
		if err != nil {
			goto ReadFieldBeginError
		}
		if fieldTypeId == thrift.STOP {
			break
		}

		switch fieldId {
		case 1:
			if fieldTypeId == thrift.BYTE {
				if err = p.ReadField1(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 2:
			if fieldTypeId == thrift.I64 {
				if err = p.ReadField2(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 3:
			if fieldTypeId == thrift.DOUBLE {
				if err = p.ReadField3(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 4:
			if fieldTypeId == thrift.I32 {
				if err = p.ReadField4(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 5:
			if fieldTypeId == thrift.STRING {
				if err = p.ReadField5(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 6:
			if fieldTypeId == thrift.STRING {
				if err = p.ReadField6(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 7:
			if fieldTypeId == thrift.I32 {
				if err = p.ReadField7(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		default:
			if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		}
		if err = iprot.ReadFieldEnd(); err != nil {
			goto ReadFieldEndError
		}
	}
	if err = iprot.ReadStructEnd(); err != nil {
		goto ReadStructEndError
	}

	return nil
ReadStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_Simple[fieldId]), err)
SkipFieldError:
	return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)

ReadFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}

func (p *Simple) ReadField1(iprot thrift.TProtocol) error {

	var _field int8
	if v, err := iprot.ReadByte(); err != nil {
		return err
	} else {
		_field = v
	}
	p.ByteField = _field
	return nil
}
func (p *Simple) ReadField2(iprot thrift.TProtocol) error {

	var _field int64
	if v, err := iprot.ReadI64(); err != nil {
		return err
	} else {
		_field = v
	}
	p.I64Field = _field
	return nil
}
func (p *Simple) ReadField3(iprot thrift.TProtocol) error {

	var _field float64
	if v, err := iprot.ReadDouble(); err != nil {
		return err
	} else {
		_field = v
	}
	p.DoubleField = _field
	return nil
}
func (p *Simple) ReadField4(iprot thrift.TProtocol) error {

	var _field int32
	if v, err := iprot.ReadI32(); err != nil {
		return err
	} else {
		_field = v
	}
	p.I32Field = _field
	return nil
}
func (p *Simple) ReadField5(iprot thrift.TProtocol) error {

	var _field string
	if v, err := iprot.ReadString(); err != nil {
		return err
	} else {
		_field = v
	}
	p.StringField = _field
	return nil
}
func (p *Simple) ReadField6(iprot thrift.TProtocol) error {

	var _field []byte
	if v, err := iprot.ReadBinary(); err != nil {
		return err
	} else {
		_field = []byte(v)
	}
	p.BinaryField = _field
	return nil
}
func (p *Simple) ReadField7(iprot thrift.TProtocol) error {

	var _field Enums
	if v, err := iprot.ReadI32(); err != nil {
		return err
	} else {
		_field = Enums(v)
	}
	p.EnumField = _field
	return nil
}

func (p *Simple) Write(oprot thrift.TProtocol) (err error) {

	var fieldId int16
	if err = oprot.WriteStructBegin("Simple"); err != nil {
		goto WriteStructBeginError
	}
	if p != nil {
		if err = p.writeField1(oprot); err != nil {
			fieldId = 1
			goto WriteFieldError
		}
		if err = p.writeField2(oprot); err != nil {
			fieldId = 2
			goto WriteFieldError
		}
		if err = p.writeField3(oprot); err != nil {
			fieldId = 3
			goto WriteFieldError
		}
		if err = p.writeField4(oprot); err != nil {
			fieldId = 4
			goto WriteFieldError
		}
		if err = p.writeField5(oprot); err != nil {
			fieldId = 5
			goto WriteFieldError
		}
		if err = p.writeField6(oprot); err != nil {
			fieldId = 6
			goto WriteFieldError
		}
		if err = p.writeField7(oprot); err != nil {
			fieldId = 7
			goto WriteFieldError
		}
	}
	if err = oprot.WriteFieldStop(); err != nil {
		goto WriteFieldStopError
	}
	if err = oprot.WriteStructEnd(); err != nil {
		goto WriteStructEndError
	}
	return nil
WriteStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
	return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}

func (p *Simple) writeField1(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("ByteField", thrift.BYTE, 1); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteByte(p.ByteField); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
}

func (p *Simple) writeField2(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("I64Field", thrift.I64, 2); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteI64(p.I64Field); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
}

func (p *Simple) writeField3(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("DoubleField", thrift.DOUBLE, 3); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteDouble(p.DoubleField); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
}

func (p *Simple) writeField4(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("I32Field", thrift.I32, 4); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteI32(p.I32Field); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err)
}

func (p *Simple) writeField5(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("StringField", thrift.STRING, 5); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteString(p.StringField); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err)
}

func (p *Simple) writeField6(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("BinaryField", thrift.STRING, 6); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteBinary([]byte(p.BinaryField)); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err)
}

func (p *Simple) writeField7(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("enumField", thrift.I32, 7); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteI32(int32(p.EnumField)); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err)
}

func (p *Simple) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("Simple(%+v)", *p)

}

type Nesting struct {
	String_         string             `thrift:"String,1" frugal:"1,default,string" json:"String"`
	ListSimple      []*Simple          `thrift:"ListSimple,2" frugal:"2,default,list<Simple>" json:"ListSimple"`
	Double          float64            `thrift:"Double,3" frugal:"3,default,double" json:"Double"`
	I32             int32              `thrift:"I32,4" frugal:"4,default,i32" json:"I32"`
	ListI32         []int32            `thrift:"ListI32,5" frugal:"5,default,list<i32>" json:"ListI32"`
	I64             int64              `thrift:"I64,6" frugal:"6,default,i64" json:"I64"`
	MapStringString map[string]string  `thrift:"MapStringString,7" frugal:"7,default,map<string:string>" json:"MapStringString"`
	SimpleStruct    *Simple            `thrift:"SimpleStruct,8" frugal:"8,default,Simple" json:"SimpleStruct"`
	MapI32I64       map[int32]int64    `thrift:"MapI32I64,9" frugal:"9,default,map<i32:i64>" json:"MapI32I64"`
	ListString      []string           `thrift:"ListString,10" frugal:"10,default,list<string>" json:"ListString"`
	Binary          []byte             `thrift:"Binary,11" frugal:"11,default,binary" json:"Binary"`
	MapI64String    map[int64]string   `thrift:"MapI64String,12" frugal:"12,default,map<i64:string>" json:"MapI64String"`
	ListI64         []int64            `thrift:"ListI64,13" frugal:"13,default,list<i64>" json:"ListI64"`
	Byte            int8               `thrift:"Byte,14" frugal:"14,default,byte" json:"Byte"`
	MapStringSimple map[string]*Simple `thrift:"MapStringSimple,15" frugal:"15,default,map<string:Simple>" json:"MapStringSimple"`
}

func NewNesting() *Nesting {
	return &Nesting{}
}

func (p *Nesting) InitDefault() {
}

func (p *Nesting) GetString() (v string) {
	return p.String_
}

func (p *Nesting) GetListSimple() (v []*Simple) {
	return p.ListSimple
}

func (p *Nesting) GetDouble() (v float64) {
	return p.Double
}

func (p *Nesting) GetI32() (v int32) {
	return p.I32
}

func (p *Nesting) GetListI32() (v []int32) {
	return p.ListI32
}

func (p *Nesting) GetI64() (v int64) {
	return p.I64
}

func (p *Nesting) GetMapStringString() (v map[string]string) {
	return p.MapStringString
}

var Nesting_SimpleStruct_DEFAULT *Simple

func (p *Nesting) GetSimpleStruct() (v *Simple) {
	if !p.IsSetSimpleStruct() {
		return Nesting_SimpleStruct_DEFAULT
	}
	return p.SimpleStruct
}

func (p *Nesting) GetMapI32I64() (v map[int32]int64) {
	return p.MapI32I64
}

func (p *Nesting) GetListString() (v []string) {
	return p.ListString
}

func (p *Nesting) GetBinary() (v []byte) {
	return p.Binary
}

func (p *Nesting) GetMapI64String() (v map[int64]string) {
	return p.MapI64String
}

func (p *Nesting) GetListI64() (v []int64) {
	return p.ListI64
}

func (p *Nesting) GetByte() (v int8) {
	return p.Byte
}

func (p *Nesting) GetMapStringSimple() (v map[string]*Simple) {
	return p.MapStringSimple
}

var fieldIDToName_Nesting = map[int16]string{
	1:  "String",
	2:  "ListSimple",
	3:  "Double",
	4:  "I32",
	5:  "ListI32",
	6:  "I64",
	7:  "MapStringString",
	8:  "SimpleStruct",
	9:  "MapI32I64",
	10: "ListString",
	11: "Binary",
	12: "MapI64String",
	13: "ListI64",
	14: "Byte",
	15: "MapStringSimple",
}

func (p *Nesting) IsSetSimpleStruct() bool {
	return p.SimpleStruct != nil
}

func (p *Nesting) Read(iprot thrift.TProtocol) (err error) {

	var fieldTypeId thrift.TType
	var fieldId int16

	if _, err = iprot.ReadStructBegin(); err != nil {
		goto ReadStructBeginError
	}

	for {
		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
		if err != nil {
			goto ReadFieldBeginError
		}
		if fieldTypeId == thrift.STOP {
			break
		}

		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRING {
				if err = p.ReadField1(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 2:
			if fieldTypeId == thrift.LIST {
				if err = p.ReadField2(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 3:
			if fieldTypeId == thrift.DOUBLE {
				if err = p.ReadField3(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 4:
			if fieldTypeId == thrift.I32 {
				if err = p.ReadField4(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 5:
			if fieldTypeId == thrift.LIST {
				if err = p.ReadField5(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 6:
			if fieldTypeId == thrift.I64 {
				if err = p.ReadField6(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 7:
			if fieldTypeId == thrift.MAP {
				if err = p.ReadField7(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 8:
			if fieldTypeId == thrift.STRUCT {
				if err = p.ReadField8(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 9:
			if fieldTypeId == thrift.MAP {
				if err = p.ReadField9(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 10:
			if fieldTypeId == thrift.LIST {
				if err = p.ReadField10(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 11:
			if fieldTypeId == thrift.STRING {
				if err = p.ReadField11(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 12:
			if fieldTypeId == thrift.MAP {
				if err = p.ReadField12(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 13:
			if fieldTypeId == thrift.LIST {
				if err = p.ReadField13(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 14:
			if fieldTypeId == thrift.BYTE {
				if err = p.ReadField14(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 15:
			if fieldTypeId == thrift.MAP {
				if err = p.ReadField15(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		default:
			if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		}
		if err = iprot.ReadFieldEnd(); err != nil {
			goto ReadFieldEndError
		}
	}
	if err = iprot.ReadStructEnd(); err != nil {
		goto ReadStructEndError
	}

	return nil
ReadStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_Nesting[fieldId]), err)
SkipFieldError:
	return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)

ReadFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}

func (p *Nesting) ReadField1(iprot thrift.TProtocol) error {

	var _field string
	if v, err := iprot.ReadString(); err != nil {
		return err
	} else {
		_field = v
	}
	p.String_ = _field
	return nil
}
func (p *Nesting) ReadField2(iprot thrift.TProtocol) error {
	_, size, err := iprot.ReadListBegin()
	if err != nil {
		return err
	}
	_field := make([]*Simple, 0, size)
	values := make([]Simple, size)
	for i := 0; i < size; i++ {
		_elem := &values[i]
		_elem.InitDefault()

		if err := _elem.Read(iprot); err != nil {
			return err
		}

		_field = append(_field, _elem)
	}
	if err := iprot.ReadListEnd(); err != nil {
		return err
	}
	p.ListSimple = _field
	return nil
}
func (p *Nesting) ReadField3(iprot thrift.TProtocol) error {

	var _field float64
	if v, err := iprot.ReadDouble(); err != nil {
		return err
	} else {
		_field = v
	}
	p.Double = _field
	return nil
}
func (p *Nesting) ReadField4(iprot thrift.TProtocol) error {

	var _field int32
	if v, err := iprot.ReadI32(); err != nil {
		return err
	} else {
		_field = v
	}
	p.I32 = _field
	return nil
}
func (p *Nesting) ReadField5(iprot thrift.TProtocol) error {
	_, size, err := iprot.ReadListBegin()
	if err != nil {
		return err
	}
	_field := make([]int32, 0, size)
	for i := 0; i < size; i++ {

		var _elem int32
		if v, err := iprot.ReadI32(); err != nil {
			return err
		} else {
			_elem = v
		}

		_field = append(_field, _elem)
	}
	if err := iprot.ReadListEnd(); err != nil {
		return err
	}
	p.ListI32 = _field
	return nil
}
func (p *Nesting) ReadField6(iprot thrift.TProtocol) error {

	var _field int64
	if v, err := iprot.ReadI64(); err != nil {
		return err
	} else {
		_field = v
	}
	p.I64 = _field
	return nil
}
func (p *Nesting) ReadField7(iprot thrift.TProtocol) error {
	_, _, size, err := iprot.ReadMapBegin()
	if err != nil {
		return err
	}
	_field := make(map[string]string, size)
	for i := 0; i < size; i++ {
		var _key string
		if v, err := iprot.ReadString(); err != nil {
			return err
		} else {
			_key = v
		}

		var _val string
		if v, err := iprot.ReadString(); err != nil {
			return err
		} else {
			_val = v
		}

		_field[_key] = _val
	}
	if err := iprot.ReadMapEnd(); err != nil {
		return err
	}
	p.MapStringString = _field
	return nil
}
func (p *Nesting) ReadField8(iprot thrift.TProtocol) error {
	_field := NewSimple()
	if err := _field.Read(iprot); err != nil {
		return err
	}
	p.SimpleStruct = _field
	return nil
}
func (p *Nesting) ReadField9(iprot thrift.TProtocol) error {
	_, _, size, err := iprot.ReadMapBegin()
	if err != nil {
		return err
	}
	_field := make(map[int32]int64, size)
	for i := 0; i < size; i++ {
		var _key int32
		if v, err := iprot.ReadI32(); err != nil {
			return err
		} else {
			_key = v
		}

		var _val int64
		if v, err := iprot.ReadI64(); err != nil {
			return err
		} else {
			_val = v
		}

		_field[_key] = _val
	}
	if err := iprot.ReadMapEnd(); err != nil {
		return err
	}
	p.MapI32I64 = _field
	return nil
}
func (p *Nesting) ReadField10(iprot thrift.TProtocol) error {
	_, size, err := iprot.ReadListBegin()
	if err != nil {
		return err
	}
	_field := make([]string, 0, size)
	for i := 0; i < size; i++ {

		var _elem string
		if v, err := iprot.ReadString(); err != nil {
			return err
		} else {
			_elem = v
		}

		_field = append(_field, _elem)
	}
	if err := iprot.ReadListEnd(); err != nil {
		return err
	}
	p.ListString = _field
	return nil
}
func (p *Nesting) ReadField11(iprot thrift.TProtocol) error {

	var _field []byte
	if v, err := iprot.ReadBinary(); err != nil {
		return err
	} else {
		_field = []byte(v)
	}
	p.Binary = _field
	return nil
}
func (p *Nesting) ReadField12(iprot thrift.TProtocol) error {
	_, _, size, err := iprot.ReadMapBegin()
	if err != nil {
		return err
	}
	_field := make(map[int64]string, size)
	for i := 0; i < size; i++ {
		var _key int64
		if v, err := iprot.ReadI64(); err != nil {
			return err
		} else {
			_key = v
		}

		var _val string
		if v, err := iprot.ReadString(); err != nil {
			return err
		} else {
			_val = v
		}

		_field[_key] = _val
	}
	if err := iprot.ReadMapEnd(); err != nil {
		return err
	}
	p.MapI64String = _field
	return nil
}
func (p *Nesting) ReadField13(iprot thrift.TProtocol) error {
	_, size, err := iprot.ReadListBegin()
	if err != nil {
		return err
	}
	_field := make([]int64, 0, size)
	for i := 0; i < size; i++ {

		var _elem int64
		if v, err := iprot.ReadI64(); err != nil {
			return err
		} else {
			_elem = v
		}

		_field = append(_field, _elem)
	}
	if err := iprot.ReadListEnd(); err != nil {
		return err
	}
	p.ListI64 = _field
	return nil
}
func (p *Nesting) ReadField14(iprot thrift.TProtocol) error {

	var _field int8
	if v, err := iprot.ReadByte(); err != nil {
		return err
	} else {
		_field = v
	}
	p.Byte = _field
	return nil
}
func (p *Nesting) ReadField15(iprot thrift.TProtocol) error {
	_, _, size, err := iprot.ReadMapBegin()
	if err != nil {
		return err
	}
	_field := make(map[string]*Simple, size)
	values := make([]Simple, size)
	for i := 0; i < size; i++ {
		var _key string
		if v, err := iprot.ReadString(); err != nil {
			return err
		} else {
			_key = v
		}

		_val := &values[i]
		_val.InitDefault()
		if err := _val.Read(iprot); err != nil {
			return err
		}

		_field[_key] = _val
	}
	if err := iprot.ReadMapEnd(); err != nil {
		return err
	}
	p.MapStringSimple = _field
	return nil
}

func (p *Nesting) Write(oprot thrift.TProtocol) (err error) {

	var fieldId int16
	if err = oprot.WriteStructBegin("Nesting"); err != nil {
		goto WriteStructBeginError
	}
	if p != nil {
		if err = p.writeField1(oprot); err != nil {
			fieldId = 1
			goto WriteFieldError
		}
		if err = p.writeField2(oprot); err != nil {
			fieldId = 2
			goto WriteFieldError
		}
		if err = p.writeField3(oprot); err != nil {
			fieldId = 3
			goto WriteFieldError
		}
		if err = p.writeField4(oprot); err != nil {
			fieldId = 4
			goto WriteFieldError
		}
		if err = p.writeField5(oprot); err != nil {
			fieldId = 5
			goto WriteFieldError
		}
		if err = p.writeField6(oprot); err != nil {
			fieldId = 6
			goto WriteFieldError
		}
		if err = p.writeField7(oprot); err != nil {
			fieldId = 7
			goto WriteFieldError
		}
		if err = p.writeField8(oprot); err != nil {
			fieldId = 8
			goto WriteFieldError
		}
		if err = p.writeField9(oprot); err != nil {
			fieldId = 9
			goto WriteFieldError
		}
		if err = p.writeField10(oprot); err != nil {
			fieldId = 10
			goto WriteFieldError
		}
		if err = p.writeField11(oprot); err != nil {
			fieldId = 11
			goto WriteFieldError
		}
		if err = p.writeField12(oprot); err != nil {
			fieldId = 12
			goto WriteFieldError
		}
		if err = p.writeField13(oprot); err != nil {
			fieldId = 13
			goto WriteFieldError
		}
		if err = p.writeField14(oprot); err != nil {
			fieldId = 14
			goto WriteFieldError
		}
		if err = p.writeField15(oprot); err != nil {
			fieldId = 15
			goto WriteFieldError
		}
	}
	if err = oprot.WriteFieldStop(); err != nil {
		goto WriteFieldStopError
	}
	if err = oprot.WriteStructEnd(); err != nil {
		goto WriteStructEndError
	}
	return nil
WriteStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
	return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}

func (p *Nesting) writeField1(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("String", thrift.STRING, 1); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteString(p.String_); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
}

func (p *Nesting) writeField2(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("ListSimple", thrift.LIST, 2); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteListBegin(thrift.STRUCT, len(p.ListSimple)); err != nil {
		return err
	}
	for _, v := range p.ListSimple {
		if err := v.Write(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteListEnd(); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
}

func (p *Nesting) writeField3(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("Double", thrift.DOUBLE, 3); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteDouble(p.Double); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
}

func (p *Nesting) writeField4(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("I32", thrift.I32, 4); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteI32(p.I32); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err)
}

func (p *Nesting) writeField5(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("ListI32", thrift.LIST, 5); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteListBegin(thrift.I32, len(p.ListI32)); err != nil {
		return err
	}
	for _, v := range p.ListI32 {
		if err := oprot.WriteI32(v); err != nil {
			return err
		}
	}
	if err := oprot.WriteListEnd(); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err)
}

func (p *Nesting) writeField6(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("I64", thrift.I64, 6); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteI64(p.I64); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err)
}

func (p *Nesting) writeField7(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("MapStringString", thrift.MAP, 7); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.MapStringString)); err != nil {
		return err
	}
	for k, v := range p.MapStringString {
		if err := oprot.WriteString(k); err != nil {
			return err
		}
		if err := oprot.WriteString(v); err != nil {
			return err
		}
	}
	if err := oprot.WriteMapEnd(); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err)
}

func (p *Nesting) writeField8(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("SimpleStruct", thrift.STRUCT, 8); err != nil {
		goto WriteFieldBeginError
	}
	if err := p.SimpleStruct.Write(oprot); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 8 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 8 end error: ", p), err)
}

func (p *Nesting) writeField9(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("MapI32I64", thrift.MAP, 9); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteMapBegin(thrift.I32, thrift.I64, len(p.MapI32I64)); err != nil {
		return err
	}
	for k, v := range p.MapI32I64 {
		if err := oprot.WriteI32(k); err != nil {
			return err
		}
		if err := oprot.WriteI64(v); err != nil {
			return err
		}
	}
	if err := oprot.WriteMapEnd(); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 9 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 9 end error: ", p), err)
}

func (p *Nesting) writeField10(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("ListString", thrift.LIST, 10); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteListBegin(thrift.STRING, len(p.ListString)); err != nil {
		return err
	}
	for _, v := range p.ListString {
		if err := oprot.WriteString(v); err != nil {
			return err
		}
	}
	if err := oprot.WriteListEnd(); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 10 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 10 end error: ", p), err)
}

func (p *Nesting) writeField11(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("Binary", thrift.STRING, 11); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteBinary([]byte(p.Binary)); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 11 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 11 end error: ", p), err)
}

func (p *Nesting) writeField12(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("MapI64String", thrift.MAP, 12); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteMapBegin(thrift.I64, thrift.STRING, len(p.MapI64String)); err != nil {
		return err
	}
	for k, v := range p.MapI64String {
		if err := oprot.WriteI64(k); err != nil {
			return err
		}
		if err := oprot.WriteString(v); err != nil {
			return err
		}
	}
	if err := oprot.WriteMapEnd(); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 12 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 12 end error: ", p), err)
}

func (p *Nesting) writeField13(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("ListI64", thrift.LIST, 13); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteListBegin(thrift.I64, len(p.ListI64)); err != nil {
		return err
	}
	for _, v := range p.ListI64 {
		if err := oprot.WriteI64(v); err != nil {
			return err
		}
	}
	if err := oprot.WriteListEnd(); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 13 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 13 end error: ", p), err)
}

func (p *Nesting) writeField14(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("Byte", thrift.BYTE, 14); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteByte(p.Byte); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 14 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 14 end error: ", p), err)
}

func (p *Nesting) writeField15(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("MapStringSimple", thrift.MAP, 15); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRUCT, len(p.MapStringSimple)); err != nil {
		return err
	}
	for k, v := range p.MapStringSimple {
		if err := oprot.WriteString(k); err != nil {
			return err
		}
		if err := v.Write(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteMapEnd(); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 15 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 15 end error: ", p), err)
}

func (p *Nesting) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("Nesting(%+v)", *p)

}

type Nesting2 struct {
	MapSimpleNesting map[*Simple]*Nesting `thrift:"MapSimpleNesting,1" frugal:"1,default,map<Simple:Nesting>" json:"MapSimpleNesting"`
	SimpleStruct     *Simple              `thrift:"SimpleStruct,2" frugal:"2,default,Simple" json:"SimpleStruct"`
	Byte             int8                 `thrift:"Byte,3" frugal:"3,default,byte" json:"Byte"`
	Double           float64              `thrift:"Double,4" frugal:"4,default,double" json:"Double"`
	ListNesting      []*Nesting           `thrift:"ListNesting,5" frugal:"5,default,list<Nesting>" json:"ListNesting"`
	I64              int64                `thrift:"I64,6" frugal:"6,default,i64" json:"I64"`
	NestingStruct    *Nesting             `thrift:"NestingStruct,7" frugal:"7,default,Nesting" json:"NestingStruct"`
	Binary           []byte               `thrift:"Binary,8" frugal:"8,default,binary" json:"Binary"`
	String_          string               `thrift:"String,9" frugal:"9,default,string" json:"String"`
	I32              int32                `thrift:"I32,11" frugal:"11,default,i32" json:"I32"`
}

func NewNesting2() *Nesting2 {
	return &Nesting2{}
}

func (p *Nesting2) InitDefault() {
}

func (p *Nesting2) GetMapSimpleNesting() (v map[*Simple]*Nesting) {
	return p.MapSimpleNesting
}

var Nesting2_SimpleStruct_DEFAULT *Simple

func (p *Nesting2) GetSimpleStruct() (v *Simple) {
	if !p.IsSetSimpleStruct() {
		return Nesting2_SimpleStruct_DEFAULT
	}
	return p.SimpleStruct
}

func (p *Nesting2) GetByte() (v int8) {
	return p.Byte
}

func (p *Nesting2) GetDouble() (v float64) {
	return p.Double
}

func (p *Nesting2) GetListNesting() (v []*Nesting) {
	return p.ListNesting
}

func (p *Nesting2) GetI64() (v int64) {
	return p.I64
}

var Nesting2_NestingStruct_DEFAULT *Nesting

func (p *Nesting2) GetNestingStruct() (v *Nesting) {
	if !p.IsSetNestingStruct() {
		return Nesting2_NestingStruct_DEFAULT
	}
	return p.NestingStruct
}

func (p *Nesting2) GetBinary() (v []byte) {
	return p.Binary
}

func (p *Nesting2) GetString() (v string) {
	return p.String_
}

func (p *Nesting2) GetI32() (v int32) {
	return p.I32
}

var fieldIDToName_Nesting2 = map[int16]string{
	1:  "MapSimpleNesting",
	2:  "SimpleStruct",
	3:  "Byte",
	4:  "Double",
	5:  "ListNesting",
	6:  "I64",
	7:  "NestingStruct",
	8:  "Binary",
	9:  "String",
	11: "I32",
}

func (p *Nesting2) IsSetSimpleStruct() bool {
	return p.SimpleStruct != nil
}

func (p *Nesting2) IsSetNestingStruct() bool {
	return p.NestingStruct != nil
}

func (p *Nesting2) Read(iprot thrift.TProtocol) (err error) {

	var fieldTypeId thrift.TType
	var fieldId int16

	if _, err = iprot.ReadStructBegin(); err != nil {
		goto ReadStructBeginError
	}

	for {
		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
		if err != nil {
			goto ReadFieldBeginError
		}
		if fieldTypeId == thrift.STOP {
			break
		}

		switch fieldId {
		case 1:
			if fieldTypeId == thrift.MAP {
				if err = p.ReadField1(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 2:
			if fieldTypeId == thrift.STRUCT {
				if err = p.ReadField2(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 3:
			if fieldTypeId == thrift.BYTE {
				if err = p.ReadField3(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 4:
			if fieldTypeId == thrift.DOUBLE {
				if err = p.ReadField4(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 5:
			if fieldTypeId == thrift.LIST {
				if err = p.ReadField5(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 6:
			if fieldTypeId == thrift.I64 {
				if err = p.ReadField6(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 7:
			if fieldTypeId == thrift.STRUCT {
				if err = p.ReadField7(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 8:
			if fieldTypeId == thrift.STRING {
				if err = p.ReadField8(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 9:
			if fieldTypeId == thrift.STRING {
				if err = p.ReadField9(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 11:
			if fieldTypeId == thrift.I32 {
				if err = p.ReadField11(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		default:
			if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		}
		if err = iprot.ReadFieldEnd(); err != nil {
			goto ReadFieldEndError
		}
	}
	if err = iprot.ReadStructEnd(); err != nil {
		goto ReadStructEndError
	}

	return nil
ReadStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_Nesting2[fieldId]), err)
SkipFieldError:
	return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)

ReadFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}

func (p *Nesting2) ReadField1(iprot thrift.TProtocol) error {
	_, _, size, err := iprot.ReadMapBegin()
	if err != nil {
		return err
	}
	_field := make(map[*Simple]*Nesting, size)
	values := make([]Nesting, size)
	for i := 0; i < size; i++ {
		_key := NewSimple()
		if err := _key.Read(iprot); err != nil {
			return err
		}

		_val := &values[i]
		_val.InitDefault()
		if err := _val.Read(iprot); err != nil {
			return err
		}

		_field[_key] = _val
	}
	if err := iprot.ReadMapEnd(); err != nil {
		return err
	}
	p.MapSimpleNesting = _field
	return nil
}
func (p *Nesting2) ReadField2(iprot thrift.TProtocol) error {
	_field := NewSimple()
	if err := _field.Read(iprot); err != nil {
		return err
	}
	p.SimpleStruct = _field
	return nil
}
func (p *Nesting2) ReadField3(iprot thrift.TProtocol) error {

	var _field int8
	if v, err := iprot.ReadByte(); err != nil {
		return err
	} else {
		_field = v
	}
	p.Byte = _field
	return nil
}
func (p *Nesting2) ReadField4(iprot thrift.TProtocol) error {

	var _field float64
	if v, err := iprot.ReadDouble(); err != nil {
		return err
	} else {
		_field = v
	}
	p.Double = _field
	return nil
}
func (p *Nesting2) ReadField5(iprot thrift.TProtocol) error {
	_, size, err := iprot.ReadListBegin()
	if err != nil {
		return err
	}
	_field := make([]*Nesting, 0, size)
	values := make([]Nesting, size)
	for i := 0; i < size; i++ {
		_elem := &values[i]
		_elem.InitDefault()

		if err := _elem.Read(iprot); err != nil {
			return err
		}

		_field = append(_field, _elem)
	}
	if err := iprot.ReadListEnd(); err != nil {
		return err
	}
	p.ListNesting = _field
	return nil
}
func (p *Nesting2) ReadField6(iprot thrift.TProtocol) error {

	var _field int64
	if v, err := iprot.ReadI64(); err != nil {
		return err
	} else {
		_field = v
	}
	p.I64 = _field
	return nil
}
func (p *Nesting2) ReadField7(iprot thrift.TProtocol) error {
	_field := NewNesting()
	if err := _field.Read(iprot); err != nil {
		return err
	}
	p.NestingStruct = _field
	return nil
}
func (p *Nesting2) ReadField8(iprot thrift.TProtocol) error {

	var _field []byte
	if v, err := iprot.ReadBinary(); err != nil {
		return err
	} else {
		_field = []byte(v)
	}
	p.Binary = _field
	return nil
}
func (p *Nesting2) ReadField9(iprot thrift.TProtocol) error {

	var _field string
	if v, err := iprot.ReadString(); err != nil {
		return err
	} else {
		_field = v
	}
	p.String_ = _field
	return nil
}
func (p *Nesting2) ReadField11(iprot thrift.TProtocol) error {

	var _field int32
	if v, err := iprot.ReadI32(); err != nil {
		return err
	} else {
		_field = v
	}
	p.I32 = _field
	return nil
}

func (p *Nesting2) Write(oprot thrift.TProtocol) (err error) {

	var fieldId int16
	if err = oprot.WriteStructBegin("Nesting2"); err != nil {
		goto WriteStructBeginError
	}
	if p != nil {
		if err = p.writeField1(oprot); err != nil {
			fieldId = 1
			goto WriteFieldError
		}
		if err = p.writeField2(oprot); err != nil {
			fieldId = 2
			goto WriteFieldError
		}
		if err = p.writeField3(oprot); err != nil {
			fieldId = 3
			goto WriteFieldError
		}
		if err = p.writeField4(oprot); err != nil {
			fieldId = 4
			goto WriteFieldError
		}
		if err = p.writeField5(oprot); err != nil {
			fieldId = 5
			goto WriteFieldError
		}
		if err = p.writeField6(oprot); err != nil {
			fieldId = 6
			goto WriteFieldError
		}
		if err = p.writeField7(oprot); err != nil {
			fieldId = 7
			goto WriteFieldError
		}
		if err = p.writeField8(oprot); err != nil {
			fieldId = 8
			goto WriteFieldError
		}
		if err = p.writeField9(oprot); err != nil {
			fieldId = 9
			goto WriteFieldError
		}
		if err = p.writeField11(oprot); err != nil {
			fieldId = 11
			goto WriteFieldError
		}
	}
	if err = oprot.WriteFieldStop(); err != nil {
		goto WriteFieldStopError
	}
	if err = oprot.WriteStructEnd(); err != nil {
		goto WriteStructEndError
	}
	return nil
WriteStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
	return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}

func (p *Nesting2) writeField1(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("MapSimpleNesting", thrift.MAP, 1); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteMapBegin(thrift.STRUCT, thrift.STRUCT, len(p.MapSimpleNesting)); err != nil {
		return err
	}
	for k, v := range p.MapSimpleNesting {
		if err := k.Write(oprot); err != nil {
			return err
		}
		if err := v.Write(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteMapEnd(); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
}

func (p *Nesting2) writeField2(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("SimpleStruct", thrift.STRUCT, 2); err != nil {
		goto WriteFieldBeginError
	}
	if err := p.SimpleStruct.Write(oprot); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
}

func (p *Nesting2) writeField3(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("Byte", thrift.BYTE, 3); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteByte(p.Byte); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
}

func (p *Nesting2) writeField4(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("Double", thrift.DOUBLE, 4); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteDouble(p.Double); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err)
}

func (p *Nesting2) writeField5(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("ListNesting", thrift.LIST, 5); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteListBegin(thrift.STRUCT, len(p.ListNesting)); err != nil {
		return err
	}
	for _, v := range p.ListNesting {
		if err := v.Write(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteListEnd(); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err)
}

func (p *Nesting2) writeField6(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("I64", thrift.I64, 6); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteI64(p.I64); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err)
}

func (p *Nesting2) writeField7(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("NestingStruct", thrift.STRUCT, 7); err != nil {
		goto WriteFieldBeginError
	}
	if err := p.NestingStruct.Write(oprot); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err)
}

func (p *Nesting2) writeField8(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("Binary", thrift.STRING, 8); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteBinary([]byte(p.Binary)); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 8 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 8 end error: ", p), err)
}

func (p *Nesting2) writeField9(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("String", thrift.STRING, 9); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteString(p.String_); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 9 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 9 end error: ", p), err)
}

func (p *Nesting2) writeField11(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("I32", thrift.I32, 11); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteI32(p.I32); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 11 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 11 end error: ", p), err)
}

func (p *Nesting2) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("Nesting2(%+v)", *p)

}

type DefaultValues struct {
	ByteFieldWithDefault       int8               `thrift:"ByteFieldWithDefault,1" frugal:"1,default,byte" json:"ByteFieldWithDefault"`
	I64FieldWithDefault        int64              `thrift:"I64FieldWithDefault,2" frugal:"2,default,i64" json:"I64FieldWithDefault"`
	DoubleFieldWithDefault     float64            `thrift:"DoubleFieldWithDefault,3" frugal:"3,default,double" json:"DoubleFieldWithDefault"`
	I32FieldWithDefault        int32              `thrift:"I32FieldWithDefault,4" frugal:"4,default,i32" json:"I32FieldWithDefault"`
	StringFieldWithDefault     string             `thrift:"StringFieldWithDefault,5" frugal:"5,default,string" json:"StringFieldWithDefault"`
	BinaryFieldWithDefault     []byte             `thrift:"BinaryFieldWithDefault,6" frugal:"6,default,binary" json:"BinaryFieldWithDefault"`
	EnumFieldWithDefault       Enums              `thrift:"EnumFieldWithDefault,7" frugal:"7,default,Enums" json:"EnumFieldWithDefault"`
	SimpleStructWithDefault    *Simple            `thrift:"SimpleStructWithDefault,8" frugal:"8,default,Simple" json:"SimpleStructWithDefault"`
	ListFieldWithDefault       []int32            `thrift:"ListFieldWithDefault,9" frugal:"9,default,list<i32>" json:"ListFieldWithDefault"`
	SetFieldWithDefault        []int32            `thrift:"SetFieldWithDefault,10" frugal:"10,default,set<i32>" json:"SetFieldWithDefault"`
	MapI32I64WithDefault       map[int32]int64    `thrift:"MapI32I64WithDefault,11" frugal:"11,default,map<i32:i64>" json:"MapI32I64WithDefault"`
	MapI64StringWithDefault    map[int64]string   `thrift:"MapI64StringWithDefault,12" frugal:"12,default,map<i64:string>" json:"MapI64StringWithDefault"`
	MapStringStringWithDefault map[string]string  `thrift:"MapStringStringWithDefault,13" frugal:"13,default,map<string:string>" json:"MapStringStringWithDefault"`
	MapStringSimpleWithDefault map[string]*Simple `thrift:"MapStringSimpleWithDefault,14" frugal:"14,default,map<string:Simple>" json:"MapStringSimpleWithDefault"`
}

func NewDefaultValues() *DefaultValues {
	return &DefaultValues{

		ByteFieldWithDefault:   1,
		I64FieldWithDefault:    2,
		DoubleFieldWithDefault: 3.0,
		I32FieldWithDefault:    4,
		StringFieldWithDefault: "string field default text",
		BinaryFieldWithDefault: []byte("binary field default data"),
		EnumFieldWithDefault:   Enums_ValueA,
		SimpleStructWithDefault: &Simple{
			ByteField:   10,
			I64Field:    11,
			DoubleField: 12.0,
			I32Field:    13,
			StringField: "simple string",
			BinaryField: []byte("simple binary"),
			EnumField:   Enums_ValueB,
		},
		ListFieldWithDefault: []int32{
			1,
			2,
			3,
			4,
			5,
		},
		SetFieldWithDefault: []int32{
			1,
			2,
			3,
			4,
			5,
		},
		MapI32I64WithDefault: map[int32]int64{
			1: 2,
			3: 4,
		},
		MapI64StringWithDefault: map[int64]string{
			1: "aaa",
			2: "bbb",
		},
		MapStringStringWithDefault: map[string]string{
			"aaa": "xxx",
			"bbb": "yyy",
		},
		MapStringSimpleWithDefault: map[string]*Simple{
			"aaa": &Simple{
				ByteField:   20,
				I64Field:    21,
				DoubleField: 22.0,
				I32Field:    23,
				StringField: "another simple string",
				BinaryField: []byte("another simple binary"),
				EnumField:   Enums_ValueC,
			},
		},
	}
}

func (p *DefaultValues) InitDefault() {
	p.ByteFieldWithDefault = 1
	p.I64FieldWithDefault = 2
	p.DoubleFieldWithDefault = 3.0
	p.I32FieldWithDefault = 4
	p.StringFieldWithDefault = "string field default text"
	p.BinaryFieldWithDefault = []byte("binary field default data")
	p.EnumFieldWithDefault = Enums_ValueA
	p.SimpleStructWithDefault = &Simple{
		ByteField:   10,
		I64Field:    11,
		DoubleField: 12.0,
		I32Field:    13,
		StringField: "simple string",
		BinaryField: []byte("simple binary"),
		EnumField:   Enums_ValueB,
	}
	p.ListFieldWithDefault = []int32{
		1,
		2,
		3,
		4,
		5,
	}
	p.SetFieldWithDefault = []int32{
		1,
		2,
		3,
		4,
		5,
	}
	p.MapI32I64WithDefault = map[int32]int64{
		1: 2,
		3: 4,
	}
	p.MapI64StringWithDefault = map[int64]string{
		1: "aaa",
		2: "bbb",
	}
	p.MapStringStringWithDefault = map[string]string{
		"aaa": "xxx",
		"bbb": "yyy",
	}
	p.MapStringSimpleWithDefault = map[string]*Simple{
		"aaa": &Simple{
			ByteField:   20,
			I64Field:    21,
			DoubleField: 22.0,
			I32Field:    23,
			StringField: "another simple string",
			BinaryField: []byte("another simple binary"),
			EnumField:   Enums_ValueC,
		},
	}
}

func (p *DefaultValues) GetByteFieldWithDefault() (v int8) {
	return p.ByteFieldWithDefault
}

func (p *DefaultValues) GetI64FieldWithDefault() (v int64) {
	return p.I64FieldWithDefault
}

func (p *DefaultValues) GetDoubleFieldWithDefault() (v float64) {
	return p.DoubleFieldWithDefault
}

func (p *DefaultValues) GetI32FieldWithDefault() (v int32) {
	return p.I32FieldWithDefault
}

func (p *DefaultValues) GetStringFieldWithDefault() (v string) {
	return p.StringFieldWithDefault
}

func (p *DefaultValues) GetBinaryFieldWithDefault() (v []byte) {
	return p.BinaryFieldWithDefault
}

func (p *DefaultValues) GetEnumFieldWithDefault() (v Enums) {
	return p.EnumFieldWithDefault
}

var DefaultValues_SimpleStructWithDefault_DEFAULT *Simple = &Simple{
	ByteField:   10,
	I64Field:    11,
	DoubleField: 12.0,
	I32Field:    13,
	StringField: "simple string",
	BinaryField: []byte("simple binary"),
	EnumField:   Enums_ValueB,
}

func (p *DefaultValues) GetSimpleStructWithDefault() (v *Simple) {
	if !p.IsSetSimpleStructWithDefault() {
		return DefaultValues_SimpleStructWithDefault_DEFAULT
	}
	return p.SimpleStructWithDefault
}

func (p *DefaultValues) GetListFieldWithDefault() (v []int32) {
	return p.ListFieldWithDefault
}

func (p *DefaultValues) GetSetFieldWithDefault() (v []int32) {
	return p.SetFieldWithDefault
}

func (p *DefaultValues) GetMapI32I64WithDefault() (v map[int32]int64) {
	return p.MapI32I64WithDefault
}

func (p *DefaultValues) GetMapI64StringWithDefault() (v map[int64]string) {
	return p.MapI64StringWithDefault
}

func (p *DefaultValues) GetMapStringStringWithDefault() (v map[string]string) {
	return p.MapStringStringWithDefault
}

func (p *DefaultValues) GetMapStringSimpleWithDefault() (v map[string]*Simple) {
	return p.MapStringSimpleWithDefault
}

var fieldIDToName_DefaultValues = map[int16]string{
	1:  "ByteFieldWithDefault",
	2:  "I64FieldWithDefault",
	3:  "DoubleFieldWithDefault",
	4:  "I32FieldWithDefault",
	5:  "StringFieldWithDefault",
	6:  "BinaryFieldWithDefault",
	7:  "EnumFieldWithDefault",
	8:  "SimpleStructWithDefault",
	9:  "ListFieldWithDefault",
	10: "SetFieldWithDefault",
	11: "MapI32I64WithDefault",
	12: "MapI64StringWithDefault",
	13: "MapStringStringWithDefault",
	14: "MapStringSimpleWithDefault",
}

func (p *DefaultValues) IsSetSimpleStructWithDefault() bool {
	return p.SimpleStructWithDefault != nil
}

func (p *DefaultValues) Read(iprot thrift.TProtocol) (err error) {

	var fieldTypeId thrift.TType
	var fieldId int16

	if _, err = iprot.ReadStructBegin(); err != nil {
		goto ReadStructBeginError
	}

	for {
		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
		if err != nil {
			goto ReadFieldBeginError
		}
		if fieldTypeId == thrift.STOP {
			break
		}

		switch fieldId {
		case 1:
			if fieldTypeId == thrift.BYTE {
				if err = p.ReadField1(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 2:
			if fieldTypeId == thrift.I64 {
				if err = p.ReadField2(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 3:
			if fieldTypeId == thrift.DOUBLE {
				if err = p.ReadField3(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 4:
			if fieldTypeId == thrift.I32 {
				if err = p.ReadField4(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 5:
			if fieldTypeId == thrift.STRING {
				if err = p.ReadField5(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 6:
			if fieldTypeId == thrift.STRING {
				if err = p.ReadField6(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 7:
			if fieldTypeId == thrift.I32 {
				if err = p.ReadField7(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 8:
			if fieldTypeId == thrift.STRUCT {
				if err = p.ReadField8(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 9:
			if fieldTypeId == thrift.LIST {
				if err = p.ReadField9(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 10:
			if fieldTypeId == thrift.SET {
				if err = p.ReadField10(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 11:
			if fieldTypeId == thrift.MAP {
				if err = p.ReadField11(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 12:
			if fieldTypeId == thrift.MAP {
				if err = p.ReadField12(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 13:
			if fieldTypeId == thrift.MAP {
				if err = p.ReadField13(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 14:
			if fieldTypeId == thrift.MAP {
				if err = p.ReadField14(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		default:
			if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		}
		if err = iprot.ReadFieldEnd(); err != nil {
			goto ReadFieldEndError
		}
	}
	if err = iprot.ReadStructEnd(); err != nil {
		goto ReadStructEndError
	}

	return nil
ReadStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_DefaultValues[fieldId]), err)
SkipFieldError:
	return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)

ReadFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}

func (p *DefaultValues) ReadField1(iprot thrift.TProtocol) error {

	var _field int8
	if v, err := iprot.ReadByte(); err != nil {
		return err
	} else {
		_field = v
	}
	p.ByteFieldWithDefault = _field
	return nil
}
func (p *DefaultValues) ReadField2(iprot thrift.TProtocol) error {

	var _field int64
	if v, err := iprot.ReadI64(); err != nil {
		return err
	} else {
		_field = v
	}
	p.I64FieldWithDefault = _field
	return nil
}
func (p *DefaultValues) ReadField3(iprot thrift.TProtocol) error {

	var _field float64
	if v, err := iprot.ReadDouble(); err != nil {
		return err
	} else {
		_field = v
	}
	p.DoubleFieldWithDefault = _field
	return nil
}
func (p *DefaultValues) ReadField4(iprot thrift.TProtocol) error {

	var _field int32
	if v, err := iprot.ReadI32(); err != nil {
		return err
	} else {
		_field = v
	}
	p.I32FieldWithDefault = _field
	return nil
}
func (p *DefaultValues) ReadField5(iprot thrift.TProtocol) error {

	var _field string
	if v, err := iprot.ReadString(); err != nil {
		return err
	} else {
		_field = v
	}
	p.StringFieldWithDefault = _field
	return nil
}
func (p *DefaultValues) ReadField6(iprot thrift.TProtocol) error {

	var _field []byte
	if v, err := iprot.ReadBinary(); err != nil {
		return err
	} else {
		_field = []byte(v)
	}
	p.BinaryFieldWithDefault = _field
	return nil
}
func (p *DefaultValues) ReadField7(iprot thrift.TProtocol) error {

	var _field Enums
	if v, err := iprot.ReadI32(); err != nil {
		return err
	} else {
		_field = Enums(v)
	}
	p.EnumFieldWithDefault = _field
	return nil
}
func (p *DefaultValues) ReadField8(iprot thrift.TProtocol) error {
	_field := NewSimple()
	if err := _field.Read(iprot); err != nil {
		return err
	}
	p.SimpleStructWithDefault = _field
	return nil
}
func (p *DefaultValues) ReadField9(iprot thrift.TProtocol) error {
	_, size, err := iprot.ReadListBegin()
	if err != nil {
		return err
	}
	_field := make([]int32, 0, size)
	for i := 0; i < size; i++ {

		var _elem int32
		if v, err := iprot.ReadI32(); err != nil {
			return err
		} else {
			_elem = v
		}

		_field = append(_field, _elem)
	}
	if err := iprot.ReadListEnd(); err != nil {
		return err
	}
	p.ListFieldWithDefault = _field
	return nil
}
func (p *DefaultValues) ReadField10(iprot thrift.TProtocol) error {
	_, size, err := iprot.ReadSetBegin()
	if err != nil {
		return err
	}
	_field := make([]int32, 0, size)
	for i := 0; i < size; i++ {

		var _elem int32
		if v, err := iprot.ReadI32(); err != nil {
			return err
		} else {
			_elem = v
		}

		_field = append(_field, _elem)
	}
	if err := iprot.ReadSetEnd(); err != nil {
		return err
	}
	p.SetFieldWithDefault = _field
	return nil
}
func (p *DefaultValues) ReadField11(iprot thrift.TProtocol) error {
	_, _, size, err := iprot.ReadMapBegin()
	if err != nil {
		return err
	}
	_field := make(map[int32]int64, size)
	for i := 0; i < size; i++ {
		var _key int32
		if v, err := iprot.ReadI32(); err != nil {
			return err
		} else {
			_key = v
		}

		var _val int64
		if v, err := iprot.ReadI64(); err != nil {
			return err
		} else {
			_val = v
		}

		_field[_key] = _val
	}
	if err := iprot.ReadMapEnd(); err != nil {
		return err
	}
	p.MapI32I64WithDefault = _field
	return nil
}
func (p *DefaultValues) ReadField12(iprot thrift.TProtocol) error {
	_, _, size, err := iprot.ReadMapBegin()
	if err != nil {
		return err
	}
	_field := make(map[int64]string, size)
	for i := 0; i < size; i++ {
		var _key int64
		if v, err := iprot.ReadI64(); err != nil {
			return err
		} else {
			_key = v
		}

		var _val string
		if v, err := iprot.ReadString(); err != nil {
			return err
		} else {
			_val = v
		}

		_field[_key] = _val
	}
	if err := iprot.ReadMapEnd(); err != nil {
		return err
	}
	p.MapI64StringWithDefault = _field
	return nil
}
func (p *DefaultValues) ReadField13(iprot thrift.TProtocol) error {
	_, _, size, err := iprot.ReadMapBegin()
	if err != nil {
		return err
	}
	_field := make(map[string]string, size)
	for i := 0; i < size; i++ {
		var _key string
		if v, err := iprot.ReadString(); err != nil {
			return err
		} else {
			_key = v
		}

		var _val string
		if v, err := iprot.ReadString(); err != nil {
			return err
		} else {
			_val = v
		}

		_field[_key] = _val
	}
	if err := iprot.ReadMapEnd(); err != nil {
		return err
	}
	p.MapStringStringWithDefault = _field
	return nil
}
func (p *DefaultValues) ReadField14(iprot thrift.TProtocol) error {
	_, _, size, err := iprot.ReadMapBegin()
	if err != nil {
		return err
	}
	_field := make(map[string]*Simple, size)
	values := make([]Simple, size)
	for i := 0; i < size; i++ {
		var _key string
		if v, err := iprot.ReadString(); err != nil {
			return err
		} else {
			_key = v
		}

		_val := &values[i]
		_val.InitDefault()
		if err := _val.Read(iprot); err != nil {
			return err
		}

		_field[_key] = _val
	}
	if err := iprot.ReadMapEnd(); err != nil {
		return err
	}
	p.MapStringSimpleWithDefault = _field
	return nil
}

func (p *DefaultValues) Write(oprot thrift.TProtocol) (err error) {

	var fieldId int16
	if err = oprot.WriteStructBegin("DefaultValues"); err != nil {
		goto WriteStructBeginError
	}
	if p != nil {
		if err = p.writeField1(oprot); err != nil {
			fieldId = 1
			goto WriteFieldError
		}
		if err = p.writeField2(oprot); err != nil {
			fieldId = 2
			goto WriteFieldError
		}
		if err = p.writeField3(oprot); err != nil {
			fieldId = 3
			goto WriteFieldError
		}
		if err = p.writeField4(oprot); err != nil {
			fieldId = 4
			goto WriteFieldError
		}
		if err = p.writeField5(oprot); err != nil {
			fieldId = 5
			goto WriteFieldError
		}
		if err = p.writeField6(oprot); err != nil {
			fieldId = 6
			goto WriteFieldError
		}
		if err = p.writeField7(oprot); err != nil {
			fieldId = 7
			goto WriteFieldError
		}
		if err = p.writeField8(oprot); err != nil {
			fieldId = 8
			goto WriteFieldError
		}
		if err = p.writeField9(oprot); err != nil {
			fieldId = 9
			goto WriteFieldError
		}
		if err = p.writeField10(oprot); err != nil {
			fieldId = 10
			goto WriteFieldError
		}
		if err = p.writeField11(oprot); err != nil {
			fieldId = 11
			goto WriteFieldError
		}
		if err = p.writeField12(oprot); err != nil {
			fieldId = 12
			goto WriteFieldError
		}
		if err = p.writeField13(oprot); err != nil {
			fieldId = 13
			goto WriteFieldError
		}
		if err = p.writeField14(oprot); err != nil {
			fieldId = 14
			goto WriteFieldError
		}
	}
	if err = oprot.WriteFieldStop(); err != nil {
		goto WriteFieldStopError
	}
	if err = oprot.WriteStructEnd(); err != nil {
		goto WriteStructEndError
	}
	return nil
WriteStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
	return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}

func (p *DefaultValues) writeField1(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("ByteFieldWithDefault", thrift.BYTE, 1); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteByte(p.ByteFieldWithDefault); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
}

func (p *DefaultValues) writeField2(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("I64FieldWithDefault", thrift.I64, 2); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteI64(p.I64FieldWithDefault); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
}

func (p *DefaultValues) writeField3(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("DoubleFieldWithDefault", thrift.DOUBLE, 3); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteDouble(p.DoubleFieldWithDefault); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
}

func (p *DefaultValues) writeField4(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("I32FieldWithDefault", thrift.I32, 4); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteI32(p.I32FieldWithDefault); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err)
}

func (p *DefaultValues) writeField5(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("StringFieldWithDefault", thrift.STRING, 5); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteString(p.StringFieldWithDefault); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err)
}

func (p *DefaultValues) writeField6(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("BinaryFieldWithDefault", thrift.STRING, 6); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteBinary([]byte(p.BinaryFieldWithDefault)); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err)
}

func (p *DefaultValues) writeField7(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("EnumFieldWithDefault", thrift.I32, 7); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteI32(int32(p.EnumFieldWithDefault)); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err)
}

func (p *DefaultValues) writeField8(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("SimpleStructWithDefault", thrift.STRUCT, 8); err != nil {
		goto WriteFieldBeginError
	}
	if err := p.SimpleStructWithDefault.Write(oprot); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 8 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 8 end error: ", p), err)
}

func (p *DefaultValues) writeField9(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("ListFieldWithDefault", thrift.LIST, 9); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteListBegin(thrift.I32, len(p.ListFieldWithDefault)); err != nil {
		return err
	}
	for _, v := range p.ListFieldWithDefault {
		if err := oprot.WriteI32(v); err != nil {
			return err
		}
	}
	if err := oprot.WriteListEnd(); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 9 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 9 end error: ", p), err)
}

func (p *DefaultValues) writeField10(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("SetFieldWithDefault", thrift.SET, 10); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteSetBegin(thrift.I32, len(p.SetFieldWithDefault)); err != nil {
		return err
	}
	for i := 0; i < len(p.SetFieldWithDefault); i++ {
		for j := i + 1; j < len(p.SetFieldWithDefault); j++ {
			if reflect.DeepEqual(p.SetFieldWithDefault[i], p.SetFieldWithDefault[j]) {
				return thrift.PrependError("", fmt.Errorf("%T error writing set field: slice is not unique", p.SetFieldWithDefault[i]))
			}
		}
	}
	for _, v := range p.SetFieldWithDefault {
		if err := oprot.WriteI32(v); err != nil {
			return err
		}
	}
	if err := oprot.WriteSetEnd(); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 10 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 10 end error: ", p), err)
}

func (p *DefaultValues) writeField11(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("MapI32I64WithDefault", thrift.MAP, 11); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteMapBegin(thrift.I32, thrift.I64, len(p.MapI32I64WithDefault)); err != nil {
		return err
	}
	for k, v := range p.MapI32I64WithDefault {
		if err := oprot.WriteI32(k); err != nil {
			return err
		}
		if err := oprot.WriteI64(v); err != nil {
			return err
		}
	}
	if err := oprot.WriteMapEnd(); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 11 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 11 end error: ", p), err)
}

func (p *DefaultValues) writeField12(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("MapI64StringWithDefault", thrift.MAP, 12); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteMapBegin(thrift.I64, thrift.STRING, len(p.MapI64StringWithDefault)); err != nil {
		return err
	}
	for k, v := range p.MapI64StringWithDefault {
		if err := oprot.WriteI64(k); err != nil {
			return err
		}
		if err := oprot.WriteString(v); err != nil {
			return err
		}
	}
	if err := oprot.WriteMapEnd(); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 12 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 12 end error: ", p), err)
}

func (p *DefaultValues) writeField13(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("MapStringStringWithDefault", thrift.MAP, 13); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.MapStringStringWithDefault)); err != nil {
		return err
	}
	for k, v := range p.MapStringStringWithDefault {
		if err := oprot.WriteString(k); err != nil {
			return err
		}
		if err := oprot.WriteString(v); err != nil {
			return err
		}
	}
	if err := oprot.WriteMapEnd(); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 13 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 13 end error: ", p), err)
}

func (p *DefaultValues) writeField14(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("MapStringSimpleWithDefault", thrift.MAP, 14); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRUCT, len(p.MapStringSimpleWithDefault)); err != nil {
		return err
	}
	for k, v := range p.MapStringSimpleWithDefault {
		if err := oprot.WriteString(k); err != nil {
			return err
		}
		if err := v.Write(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteMapEnd(); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 14 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 14 end error: ", p), err)
}

func (p *DefaultValues) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("DefaultValues(%+v)", *p)

}

type OptionalDefaultValues struct {
	ByteFieldWithDefault       int8               `thrift:"ByteFieldWithDefault,1,optional" frugal:"1,optional,byte" json:"ByteFieldWithDefault,omitempty"`
	I64FieldWithDefault        int64              `thrift:"I64FieldWithDefault,2,optional" frugal:"2,optional,i64" json:"I64FieldWithDefault,omitempty"`
	DoubleFieldWithDefault     float64            `thrift:"DoubleFieldWithDefault,3,optional" frugal:"3,optional,double" json:"DoubleFieldWithDefault,omitempty"`
	I32FieldWithDefault        int32              `thrift:"I32FieldWithDefault,4,optional" frugal:"4,optional,i32" json:"I32FieldWithDefault,omitempty"`
	StringFieldWithDefault     string             `thrift:"StringFieldWithDefault,5,optional" frugal:"5,optional,string" json:"StringFieldWithDefault,omitempty"`
	BinaryFieldWithDefault     []byte             `thrift:"BinaryFieldWithDefault,6,optional" frugal:"6,optional,binary" json:"BinaryFieldWithDefault,omitempty"`
	EnumFieldWithDefault       Enums              `thrift:"EnumFieldWithDefault,7,optional" frugal:"7,optional,Enums" json:"EnumFieldWithDefault,omitempty"`
	SimpleStructWithDefault    *Simple            `thrift:"SimpleStructWithDefault,8,optional" frugal:"8,optional,Simple" json:"SimpleStructWithDefault,omitempty"`
	ListFieldWithDefault       []int32            `thrift:"ListFieldWithDefault,9,optional" frugal:"9,optional,list<i32>" json:"ListFieldWithDefault,omitempty"`
	SetFieldWithDefault        []int32            `thrift:"SetFieldWithDefault,10,optional" frugal:"10,optional,set<i32>" json:"SetFieldWithDefault,omitempty"`
	MapI32I64WithDefault       map[int32]int64    `thrift:"MapI32I64WithDefault,11,optional" frugal:"11,optional,map<i32:i64>" json:"MapI32I64WithDefault,omitempty"`
	MapI64StringWithDefault    map[int64]string   `thrift:"MapI64StringWithDefault,12,optional" frugal:"12,optional,map<i64:string>" json:"MapI64StringWithDefault,omitempty"`
	MapStringStringWithDefault map[string]string  `thrift:"MapStringStringWithDefault,13,optional" frugal:"13,optional,map<string:string>" json:"MapStringStringWithDefault,omitempty"`
	MapStringSimpleWithDefault map[string]*Simple `thrift:"MapStringSimpleWithDefault,14,optional" frugal:"14,optional,map<string:Simple>" json:"MapStringSimpleWithDefault,omitempty"`
}

func NewOptionalDefaultValues() *OptionalDefaultValues {
	return &OptionalDefaultValues{

		ByteFieldWithDefault:   1,
		I64FieldWithDefault:    2,
		DoubleFieldWithDefault: 3.0,
		I32FieldWithDefault:    4,
		StringFieldWithDefault: "string field default text",
		BinaryFieldWithDefault: []byte("binary field default data"),
		EnumFieldWithDefault:   Enums_ValueA,
		SimpleStructWithDefault: &Simple{
			ByteField:   10,
			I64Field:    11,
			DoubleField: 12.0,
			I32Field:    13,
			StringField: "simple string",
			BinaryField: []byte("simple binary"),
			EnumField:   Enums_ValueB,
		},
		ListFieldWithDefault: []int32{
			1,
			2,
			3,
			4,
			5,
		},
		SetFieldWithDefault: []int32{
			1,
			2,
			3,
			4,
			5,
		},
		MapI32I64WithDefault: map[int32]int64{
			1: 2,
			3: 4,
		},
		MapI64StringWithDefault: map[int64]string{
			1: "aaa",
			2: "bbb",
		},
		MapStringStringWithDefault: map[string]string{
			"aaa": "xxx",
			"bbb": "yyy",
		},
		MapStringSimpleWithDefault: map[string]*Simple{
			"aaa": &Simple{
				ByteField:   20,
				I64Field:    21,
				DoubleField: 22.0,
				I32Field:    23,
				StringField: "another simple string",
				BinaryField: []byte("another simple binary"),
				EnumField:   Enums_ValueC,
			},
		},
	}
}

func (p *OptionalDefaultValues) InitDefault() {
	p.ByteFieldWithDefault = 1
	p.I64FieldWithDefault = 2
	p.DoubleFieldWithDefault = 3.0
	p.I32FieldWithDefault = 4
	p.StringFieldWithDefault = "string field default text"
	p.BinaryFieldWithDefault = []byte("binary field default data")
	p.EnumFieldWithDefault = Enums_ValueA
	p.SimpleStructWithDefault = &Simple{
		ByteField:   10,
		I64Field:    11,
		DoubleField: 12.0,
		I32Field:    13,
		StringField: "simple string",
		BinaryField: []byte("simple binary"),
		EnumField:   Enums_ValueB,
	}
	p.ListFieldWithDefault = []int32{
		1,
		2,
		3,
		4,
		5,
	}
	p.SetFieldWithDefault = []int32{
		1,
		2,
		3,
		4,
		5,
	}
	p.MapI32I64WithDefault = map[int32]int64{
		1: 2,
		3: 4,
	}
	p.MapI64StringWithDefault = map[int64]string{
		1: "aaa",
		2: "bbb",
	}
	p.MapStringStringWithDefault = map[string]string{
		"aaa": "xxx",
		"bbb": "yyy",
	}
	p.MapStringSimpleWithDefault = map[string]*Simple{
		"aaa": &Simple{
			ByteField:   20,
			I64Field:    21,
			DoubleField: 22.0,
			I32Field:    23,
			StringField: "another simple string",
			BinaryField: []byte("another simple binary"),
			EnumField:   Enums_ValueC,
		},
	}
}

var OptionalDefaultValues_ByteFieldWithDefault_DEFAULT int8 = 1

func (p *OptionalDefaultValues) GetByteFieldWithDefault() (v int8) {
	if !p.IsSetByteFieldWithDefault() {
		return OptionalDefaultValues_ByteFieldWithDefault_DEFAULT
	}
	return p.ByteFieldWithDefault
}

var OptionalDefaultValues_I64FieldWithDefault_DEFAULT int64 = 2

func (p *OptionalDefaultValues) GetI64FieldWithDefault() (v int64) {
	if !p.IsSetI64FieldWithDefault() {
		return OptionalDefaultValues_I64FieldWithDefault_DEFAULT
	}
	return p.I64FieldWithDefault
}

var OptionalDefaultValues_DoubleFieldWithDefault_DEFAULT float64 = 3.0

func (p *OptionalDefaultValues) GetDoubleFieldWithDefault() (v float64) {
	if !p.IsSetDoubleFieldWithDefault() {
		return OptionalDefaultValues_DoubleFieldWithDefault_DEFAULT
	}
	return p.DoubleFieldWithDefault
}

var OptionalDefaultValues_I32FieldWithDefault_DEFAULT int32 = 4

func (p *OptionalDefaultValues) GetI32FieldWithDefault() (v int32) {
	if !p.IsSetI32FieldWithDefault() {
		return OptionalDefaultValues_I32FieldWithDefault_DEFAULT
	}
	return p.I32FieldWithDefault
}

var OptionalDefaultValues_StringFieldWithDefault_DEFAULT string = "string field default text"

func (p *OptionalDefaultValues) GetStringFieldWithDefault() (v string) {
	if !p.IsSetStringFieldWithDefault() {
		return OptionalDefaultValues_StringFieldWithDefault_DEFAULT
	}
	return p.StringFieldWithDefault
}

var OptionalDefaultValues_BinaryFieldWithDefault_DEFAULT []byte = []byte("binary field default data")

func (p *OptionalDefaultValues) GetBinaryFieldWithDefault() (v []byte) {
	if !p.IsSetBinaryFieldWithDefault() {
		return OptionalDefaultValues_BinaryFieldWithDefault_DEFAULT
	}
	return p.BinaryFieldWithDefault
}

var OptionalDefaultValues_EnumFieldWithDefault_DEFAULT Enums = Enums_ValueA

func (p *OptionalDefaultValues) GetEnumFieldWithDefault() (v Enums) {
	if !p.IsSetEnumFieldWithDefault() {
		return OptionalDefaultValues_EnumFieldWithDefault_DEFAULT
	}
	return p.EnumFieldWithDefault
}

var OptionalDefaultValues_SimpleStructWithDefault_DEFAULT *Simple = &Simple{
	ByteField:   10,
	I64Field:    11,
	DoubleField: 12.0,
	I32Field:    13,
	StringField: "simple string",
	BinaryField: []byte("simple binary"),
	EnumField:   Enums_ValueB,
}

func (p *OptionalDefaultValues) GetSimpleStructWithDefault() (v *Simple) {
	if !p.IsSetSimpleStructWithDefault() {
		return OptionalDefaultValues_SimpleStructWithDefault_DEFAULT
	}
	return p.SimpleStructWithDefault
}

var OptionalDefaultValues_ListFieldWithDefault_DEFAULT []int32 = []int32{
	1,
	2,
	3,
	4,
	5,
}

func (p *OptionalDefaultValues) GetListFieldWithDefault() (v []int32) {
	if !p.IsSetListFieldWithDefault() {
		return OptionalDefaultValues_ListFieldWithDefault_DEFAULT
	}
	return p.ListFieldWithDefault
}

var OptionalDefaultValues_SetFieldWithDefault_DEFAULT []int32 = []int32{
	1,
	2,
	3,
	4,
	5,
}

func (p *OptionalDefaultValues) GetSetFieldWithDefault() (v []int32) {
	if !p.IsSetSetFieldWithDefault() {
		return OptionalDefaultValues_SetFieldWithDefault_DEFAULT
	}
	return p.SetFieldWithDefault
}

var OptionalDefaultValues_MapI32I64WithDefault_DEFAULT map[int32]int64 = map[int32]int64{
	1: 2,
	3: 4,
}

func (p *OptionalDefaultValues) GetMapI32I64WithDefault() (v map[int32]int64) {
	if !p.IsSetMapI32I64WithDefault() {
		return OptionalDefaultValues_MapI32I64WithDefault_DEFAULT
	}
	return p.MapI32I64WithDefault
}

var OptionalDefaultValues_MapI64StringWithDefault_DEFAULT map[int64]string = map[int64]string{
	1: "aaa",
	2: "bbb",
}

func (p *OptionalDefaultValues) GetMapI64StringWithDefault() (v map[int64]string) {
	if !p.IsSetMapI64StringWithDefault() {
		return OptionalDefaultValues_MapI64StringWithDefault_DEFAULT
	}
	return p.MapI64StringWithDefault
}

var OptionalDefaultValues_MapStringStringWithDefault_DEFAULT map[string]string = map[string]string{
	"aaa": "xxx",
	"bbb": "yyy",
}

func (p *OptionalDefaultValues) GetMapStringStringWithDefault() (v map[string]string) {
	if !p.IsSetMapStringStringWithDefault() {
		return OptionalDefaultValues_MapStringStringWithDefault_DEFAULT
	}
	return p.MapStringStringWithDefault
}

var OptionalDefaultValues_MapStringSimpleWithDefault_DEFAULT map[string]*Simple = map[string]*Simple{
	"aaa": &Simple{
		ByteField:   20,
		I64Field:    21,
		DoubleField: 22.0,
		I32Field:    23,
		StringField: "another simple string",
		BinaryField: []byte("another simple binary"),
		EnumField:   Enums_ValueC,
	},
}

func (p *OptionalDefaultValues) GetMapStringSimpleWithDefault() (v map[string]*Simple) {
	if !p.IsSetMapStringSimpleWithDefault() {
		return OptionalDefaultValues_MapStringSimpleWithDefault_DEFAULT
	}
	return p.MapStringSimpleWithDefault
}

var fieldIDToName_OptionalDefaultValues = map[int16]string{
	1:  "ByteFieldWithDefault",
	2:  "I64FieldWithDefault",
	3:  "DoubleFieldWithDefault",
	4:  "I32FieldWithDefault",
	5:  "StringFieldWithDefault",
	6:  "BinaryFieldWithDefault",
	7:  "EnumFieldWithDefault",
	8:  "SimpleStructWithDefault",
	9:  "ListFieldWithDefault",
	10: "SetFieldWithDefault",
	11: "MapI32I64WithDefault",
	12: "MapI64StringWithDefault",
	13: "MapStringStringWithDefault",
	14: "MapStringSimpleWithDefault",
}

func (p *OptionalDefaultValues) IsSetByteFieldWithDefault() bool {
	return p.ByteFieldWithDefault != OptionalDefaultValues_ByteFieldWithDefault_DEFAULT
}

func (p *OptionalDefaultValues) IsSetI64FieldWithDefault() bool {
	return p.I64FieldWithDefault != OptionalDefaultValues_I64FieldWithDefault_DEFAULT
}

func (p *OptionalDefaultValues) IsSetDoubleFieldWithDefault() bool {
	return p.DoubleFieldWithDefault != OptionalDefaultValues_DoubleFieldWithDefault_DEFAULT
}

func (p *OptionalDefaultValues) IsSetI32FieldWithDefault() bool {
	return p.I32FieldWithDefault != OptionalDefaultValues_I32FieldWithDefault_DEFAULT
}

func (p *OptionalDefaultValues) IsSetStringFieldWithDefault() bool {
	return p.StringFieldWithDefault != OptionalDefaultValues_StringFieldWithDefault_DEFAULT
}

func (p *OptionalDefaultValues) IsSetBinaryFieldWithDefault() bool {
	return string(p.BinaryFieldWithDefault) != string(OptionalDefaultValues_BinaryFieldWithDefault_DEFAULT)
}

func (p *OptionalDefaultValues) IsSetEnumFieldWithDefault() bool {
	return p.EnumFieldWithDefault != OptionalDefaultValues_EnumFieldWithDefault_DEFAULT
}

func (p *OptionalDefaultValues) IsSetSimpleStructWithDefault() bool {
	return p.SimpleStructWithDefault != nil
}

func (p *OptionalDefaultValues) IsSetListFieldWithDefault() bool {
	return p.ListFieldWithDefault != nil
}

func (p *OptionalDefaultValues) IsSetSetFieldWithDefault() bool {
	return p.SetFieldWithDefault != nil
}

func (p *OptionalDefaultValues) IsSetMapI32I64WithDefault() bool {
	return p.MapI32I64WithDefault != nil
}

func (p *OptionalDefaultValues) IsSetMapI64StringWithDefault() bool {
	return p.MapI64StringWithDefault != nil
}

func (p *OptionalDefaultValues) IsSetMapStringStringWithDefault() bool {
	return p.MapStringStringWithDefault != nil
}

func (p *OptionalDefaultValues) IsSetMapStringSimpleWithDefault() bool {
	return p.MapStringSimpleWithDefault != nil
}

func (p *OptionalDefaultValues) Read(iprot thrift.TProtocol) (err error) {

	var fieldTypeId thrift.TType
	var fieldId int16

	if _, err = iprot.ReadStructBegin(); err != nil {
		goto ReadStructBeginError
	}

	for {
		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
		if err != nil {
			goto ReadFieldBeginError
		}
		if fieldTypeId == thrift.STOP {
			break
		}

		switch fieldId {
		case 1:
			if fieldTypeId == thrift.BYTE {
				if err = p.ReadField1(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 2:
			if fieldTypeId == thrift.I64 {
				if err = p.ReadField2(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 3:
			if fieldTypeId == thrift.DOUBLE {
				if err = p.ReadField3(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 4:
			if fieldTypeId == thrift.I32 {
				if err = p.ReadField4(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 5:
			if fieldTypeId == thrift.STRING {
				if err = p.ReadField5(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 6:
			if fieldTypeId == thrift.STRING {
				if err = p.ReadField6(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 7:
			if fieldTypeId == thrift.I32 {
				if err = p.ReadField7(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 8:
			if fieldTypeId == thrift.STRUCT {
				if err = p.ReadField8(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 9:
			if fieldTypeId == thrift.LIST {
				if err = p.ReadField9(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 10:
			if fieldTypeId == thrift.SET {
				if err = p.ReadField10(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 11:
			if fieldTypeId == thrift.MAP {
				if err = p.ReadField11(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 12:
			if fieldTypeId == thrift.MAP {
				if err = p.ReadField12(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 13:
			if fieldTypeId == thrift.MAP {
				if err = p.ReadField13(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		case 14:
			if fieldTypeId == thrift.MAP {
				if err = p.ReadField14(iprot); err != nil {
					goto ReadFieldError
				}
			} else if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		default:
			if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		}
		if err = iprot.ReadFieldEnd(); err != nil {
			goto ReadFieldEndError
		}
	}
	if err = iprot.ReadStructEnd(); err != nil {
		goto ReadStructEndError
	}

	return nil
ReadStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_OptionalDefaultValues[fieldId]), err)
SkipFieldError:
	return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)

ReadFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}

func (p *OptionalDefaultValues) ReadField1(iprot thrift.TProtocol) error {

	var _field int8
	if v, err := iprot.ReadByte(); err != nil {
		return err
	} else {
		_field = v
	}
	p.ByteFieldWithDefault = _field
	return nil
}
func (p *OptionalDefaultValues) ReadField2(iprot thrift.TProtocol) error {

	var _field int64
	if v, err := iprot.ReadI64(); err != nil {
		return err
	} else {
		_field = v
	}
	p.I64FieldWithDefault = _field
	return nil
}
func (p *OptionalDefaultValues) ReadField3(iprot thrift.TProtocol) error {

	var _field float64
	if v, err := iprot.ReadDouble(); err != nil {
		return err
	} else {
		_field = v
	}
	p.DoubleFieldWithDefault = _field
	return nil
}
func (p *OptionalDefaultValues) ReadField4(iprot thrift.TProtocol) error {

	var _field int32
	if v, err := iprot.ReadI32(); err != nil {
		return err
	} else {
		_field = v
	}
	p.I32FieldWithDefault = _field
	return nil
}
func (p *OptionalDefaultValues) ReadField5(iprot thrift.TProtocol) error {

	var _field string
	if v, err := iprot.ReadString(); err != nil {
		return err
	} else {
		_field = v
	}
	p.StringFieldWithDefault = _field
	return nil
}
func (p *OptionalDefaultValues) ReadField6(iprot thrift.TProtocol) error {

	var _field []byte
	if v, err := iprot.ReadBinary(); err != nil {
		return err
	} else {
		_field = []byte(v)
	}
	p.BinaryFieldWithDefault = _field
	return nil
}
func (p *OptionalDefaultValues) ReadField7(iprot thrift.TProtocol) error {

	var _field Enums
	if v, err := iprot.ReadI32(); err != nil {
		return err
	} else {
		_field = Enums(v)
	}
	p.EnumFieldWithDefault = _field
	return nil
}
func (p *OptionalDefaultValues) ReadField8(iprot thrift.TProtocol) error {
	_field := NewSimple()
	if err := _field.Read(iprot); err != nil {
		return err
	}
	p.SimpleStructWithDefault = _field
	return nil
}
func (p *OptionalDefaultValues) ReadField9(iprot thrift.TProtocol) error {
	_, size, err := iprot.ReadListBegin()
	if err != nil {
		return err
	}
	_field := make([]int32, 0, size)
	for i := 0; i < size; i++ {

		var _elem int32
		if v, err := iprot.ReadI32(); err != nil {
			return err
		} else {
			_elem = v
		}

		_field = append(_field, _elem)
	}
	if err := iprot.ReadListEnd(); err != nil {
		return err
	}
	p.ListFieldWithDefault = _field
	return nil
}
func (p *OptionalDefaultValues) ReadField10(iprot thrift.TProtocol) error {
	_, size, err := iprot.ReadSetBegin()
	if err != nil {
		return err
	}
	_field := make([]int32, 0, size)
	for i := 0; i < size; i++ {

		var _elem int32
		if v, err := iprot.ReadI32(); err != nil {
			return err
		} else {
			_elem = v
		}

		_field = append(_field, _elem)
	}
	if err := iprot.ReadSetEnd(); err != nil {
		return err
	}
	p.SetFieldWithDefault = _field
	return nil
}
func (p *OptionalDefaultValues) ReadField11(iprot thrift.TProtocol) error {
	_, _, size, err := iprot.ReadMapBegin()
	if err != nil {
		return err
	}
	_field := make(map[int32]int64, size)
	for i := 0; i < size; i++ {
		var _key int32
		if v, err := iprot.ReadI32(); err != nil {
			return err
		} else {
			_key = v
		}

		var _val int64
		if v, err := iprot.ReadI64(); err != nil {
			return err
		} else {
			_val = v
		}

		_field[_key] = _val
	}
	if err := iprot.ReadMapEnd(); err != nil {
		return err
	}
	p.MapI32I64WithDefault = _field
	return nil
}
func (p *OptionalDefaultValues) ReadField12(iprot thrift.TProtocol) error {
	_, _, size, err := iprot.ReadMapBegin()
	if err != nil {
		return err
	}
	_field := make(map[int64]string, size)
	for i := 0; i < size; i++ {
		var _key int64
		if v, err := iprot.ReadI64(); err != nil {
			return err
		} else {
			_key = v
		}

		var _val string
		if v, err := iprot.ReadString(); err != nil {
			return err
		} else {
			_val = v
		}

		_field[_key] = _val
	}
	if err := iprot.ReadMapEnd(); err != nil {
		return err
	}
	p.MapI64StringWithDefault = _field
	return nil
}
func (p *OptionalDefaultValues) ReadField13(iprot thrift.TProtocol) error {
	_, _, size, err := iprot.ReadMapBegin()
	if err != nil {
		return err
	}
	_field := make(map[string]string, size)
	for i := 0; i < size; i++ {
		var _key string
		if v, err := iprot.ReadString(); err != nil {
			return err
		} else {
			_key = v
		}

		var _val string
		if v, err := iprot.ReadString(); err != nil {
			return err
		} else {
			_val = v
		}

		_field[_key] = _val
	}
	if err := iprot.ReadMapEnd(); err != nil {
		return err
	}
	p.MapStringStringWithDefault = _field
	return nil
}
func (p *OptionalDefaultValues) ReadField14(iprot thrift.TProtocol) error {
	_, _, size, err := iprot.ReadMapBegin()
	if err != nil {
		return err
	}
	_field := make(map[string]*Simple, size)
	values := make([]Simple, size)
	for i := 0; i < size; i++ {
		var _key string
		if v, err := iprot.ReadString(); err != nil {
			return err
		} else {
			_key = v
		}

		_val := &values[i]
		_val.InitDefault()
		if err := _val.Read(iprot); err != nil {
			return err
		}

		_field[_key] = _val
	}
	if err := iprot.ReadMapEnd(); err != nil {
		return err
	}
	p.MapStringSimpleWithDefault = _field
	return nil
}

func (p *OptionalDefaultValues) Write(oprot thrift.TProtocol) (err error) {

	var fieldId int16
	if err = oprot.WriteStructBegin("OptionalDefaultValues"); err != nil {
		goto WriteStructBeginError
	}
	if p != nil {
		if err = p.writeField1(oprot); err != nil {
			fieldId = 1
			goto WriteFieldError
		}
		if err = p.writeField2(oprot); err != nil {
			fieldId = 2
			goto WriteFieldError
		}
		if err = p.writeField3(oprot); err != nil {
			fieldId = 3
			goto WriteFieldError
		}
		if err = p.writeField4(oprot); err != nil {
			fieldId = 4
			goto WriteFieldError
		}
		if err = p.writeField5(oprot); err != nil {
			fieldId = 5
			goto WriteFieldError
		}
		if err = p.writeField6(oprot); err != nil {
			fieldId = 6
			goto WriteFieldError
		}
		if err = p.writeField7(oprot); err != nil {
			fieldId = 7
			goto WriteFieldError
		}
		if err = p.writeField8(oprot); err != nil {
			fieldId = 8
			goto WriteFieldError
		}
		if err = p.writeField9(oprot); err != nil {
			fieldId = 9
			goto WriteFieldError
		}
		if err = p.writeField10(oprot); err != nil {
			fieldId = 10
			goto WriteFieldError
		}
		if err = p.writeField11(oprot); err != nil {
			fieldId = 11
			goto WriteFieldError
		}
		if err = p.writeField12(oprot); err != nil {
			fieldId = 12
			goto WriteFieldError
		}
		if err = p.writeField13(oprot); err != nil {
			fieldId = 13
			goto WriteFieldError
		}
		if err = p.writeField14(oprot); err != nil {
			fieldId = 14
			goto WriteFieldError
		}
	}
	if err = oprot.WriteFieldStop(); err != nil {
		goto WriteFieldStopError
	}
	if err = oprot.WriteStructEnd(); err != nil {
		goto WriteStructEndError
	}
	return nil
WriteStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
	return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}

func (p *OptionalDefaultValues) writeField1(oprot thrift.TProtocol) (err error) {
	if p.IsSetByteFieldWithDefault() {
		if err = oprot.WriteFieldBegin("ByteFieldWithDefault", thrift.BYTE, 1); err != nil {
			goto WriteFieldBeginError
		}
		if err := oprot.WriteByte(p.ByteFieldWithDefault); err != nil {
			return err
		}
		if err = oprot.WriteFieldEnd(); err != nil {
			goto WriteFieldEndError
		}
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
}

func (p *OptionalDefaultValues) writeField2(oprot thrift.TProtocol) (err error) {
	if p.IsSetI64FieldWithDefault() {
		if err = oprot.WriteFieldBegin("I64FieldWithDefault", thrift.I64, 2); err != nil {
			goto WriteFieldBeginError
		}
		if err := oprot.WriteI64(p.I64FieldWithDefault); err != nil {
			return err
		}
		if err = oprot.WriteFieldEnd(); err != nil {
			goto WriteFieldEndError
		}
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
}

func (p *OptionalDefaultValues) writeField3(oprot thrift.TProtocol) (err error) {
	if p.IsSetDoubleFieldWithDefault() {
		if err = oprot.WriteFieldBegin("DoubleFieldWithDefault", thrift.DOUBLE, 3); err != nil {
			goto WriteFieldBeginError
		}
		if err := oprot.WriteDouble(p.DoubleFieldWithDefault); err != nil {
			return err
		}
		if err = oprot.WriteFieldEnd(); err != nil {
			goto WriteFieldEndError
		}
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
}

func (p *OptionalDefaultValues) writeField4(oprot thrift.TProtocol) (err error) {
	if p.IsSetI32FieldWithDefault() {
		if err = oprot.WriteFieldBegin("I32FieldWithDefault", thrift.I32, 4); err != nil {
			goto WriteFieldBeginError
		}
		if err := oprot.WriteI32(p.I32FieldWithDefault); err != nil {
			return err
		}
		if err = oprot.WriteFieldEnd(); err != nil {
			goto WriteFieldEndError
		}
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err)
}

func (p *OptionalDefaultValues) writeField5(oprot thrift.TProtocol) (err error) {
	if p.IsSetStringFieldWithDefault() {
		if err = oprot.WriteFieldBegin("StringFieldWithDefault", thrift.STRING, 5); err != nil {
			goto WriteFieldBeginError
		}
		if err := oprot.WriteString(p.StringFieldWithDefault); err != nil {
			return err
		}
		if err = oprot.WriteFieldEnd(); err != nil {
			goto WriteFieldEndError
		}
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err)
}

func (p *OptionalDefaultValues) writeField6(oprot thrift.TProtocol) (err error) {
	if p.IsSetBinaryFieldWithDefault() {
		if err = oprot.WriteFieldBegin("BinaryFieldWithDefault", thrift.STRING, 6); err != nil {
			goto WriteFieldBeginError
		}
		if err := oprot.WriteBinary([]byte(p.BinaryFieldWithDefault)); err != nil {
			return err
		}
		if err = oprot.WriteFieldEnd(); err != nil {
			goto WriteFieldEndError
		}
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err)
}

func (p *OptionalDefaultValues) writeField7(oprot thrift.TProtocol) (err error) {
	if p.IsSetEnumFieldWithDefault() {
		if err = oprot.WriteFieldBegin("EnumFieldWithDefault", thrift.I32, 7); err != nil {
			goto WriteFieldBeginError
		}
		if err := oprot.WriteI32(int32(p.EnumFieldWithDefault)); err != nil {
			return err
		}
		if err = oprot.WriteFieldEnd(); err != nil {
			goto WriteFieldEndError
		}
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err)
}

func (p *OptionalDefaultValues) writeField8(oprot thrift.TProtocol) (err error) {
	if p.IsSetSimpleStructWithDefault() {
		if err = oprot.WriteFieldBegin("SimpleStructWithDefault", thrift.STRUCT, 8); err != nil {
			goto WriteFieldBeginError
		}
		if err := p.SimpleStructWithDefault.Write(oprot); err != nil {
			return err
		}
		if err = oprot.WriteFieldEnd(); err != nil {
			goto WriteFieldEndError
		}
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 8 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 8 end error: ", p), err)
}

func (p *OptionalDefaultValues) writeField9(oprot thrift.TProtocol) (err error) {
	if p.IsSetListFieldWithDefault() {
		if err = oprot.WriteFieldBegin("ListFieldWithDefault", thrift.LIST, 9); err != nil {
			goto WriteFieldBeginError
		}
		if err := oprot.WriteListBegin(thrift.I32, len(p.ListFieldWithDefault)); err != nil {
			return err
		}
		for _, v := range p.ListFieldWithDefault {
			if err := oprot.WriteI32(v); err != nil {
				return err
			}
		}
		if err := oprot.WriteListEnd(); err != nil {
			return err
		}
		if err = oprot.WriteFieldEnd(); err != nil {
			goto WriteFieldEndError
		}
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 9 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 9 end error: ", p), err)
}

func (p *OptionalDefaultValues) writeField10(oprot thrift.TProtocol) (err error) {
	if p.IsSetSetFieldWithDefault() {
		if err = oprot.WriteFieldBegin("SetFieldWithDefault", thrift.SET, 10); err != nil {
			goto WriteFieldBeginError
		}
		if err := oprot.WriteSetBegin(thrift.I32, len(p.SetFieldWithDefault)); err != nil {
			return err
		}
		for i := 0; i < len(p.SetFieldWithDefault); i++ {
			for j := i + 1; j < len(p.SetFieldWithDefault); j++ {
				if reflect.DeepEqual(p.SetFieldWithDefault[i], p.SetFieldWithDefault[j]) {
					return thrift.PrependError("", fmt.Errorf("%T error writing set field: slice is not unique", p.SetFieldWithDefault[i]))
				}
			}
		}
		for _, v := range p.SetFieldWithDefault {
			if err := oprot.WriteI32(v); err != nil {
				return err
			}
		}
		if err := oprot.WriteSetEnd(); err != nil {
			return err
		}
		if err = oprot.WriteFieldEnd(); err != nil {
			goto WriteFieldEndError
		}
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 10 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 10 end error: ", p), err)
}

func (p *OptionalDefaultValues) writeField11(oprot thrift.TProtocol) (err error) {
	if p.IsSetMapI32I64WithDefault() {
		if err = oprot.WriteFieldBegin("MapI32I64WithDefault", thrift.MAP, 11); err != nil {
			goto WriteFieldBeginError
		}
		if err := oprot.WriteMapBegin(thrift.I32, thrift.I64, len(p.MapI32I64WithDefault)); err != nil {
			return err
		}
		for k, v := range p.MapI32I64WithDefault {
			if err := oprot.WriteI32(k); err != nil {
				return err
			}
			if err := oprot.WriteI64(v); err != nil {
				return err
			}
		}
		if err := oprot.WriteMapEnd(); err != nil {
			return err
		}
		if err = oprot.WriteFieldEnd(); err != nil {
			goto WriteFieldEndError
		}
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 11 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 11 end error: ", p), err)
}

func (p *OptionalDefaultValues) writeField12(oprot thrift.TProtocol) (err error) {
	if p.IsSetMapI64StringWithDefault() {
		if err = oprot.WriteFieldBegin("MapI64StringWithDefault", thrift.MAP, 12); err != nil {
			goto WriteFieldBeginError
		}
		if err := oprot.WriteMapBegin(thrift.I64, thrift.STRING, len(p.MapI64StringWithDefault)); err != nil {
			return err
		}
		for k, v := range p.MapI64StringWithDefault {
			if err := oprot.WriteI64(k); err != nil {
				return err
			}
			if err := oprot.WriteString(v); err != nil {
				return err
			}
		}
		if err := oprot.WriteMapEnd(); err != nil {
			return err
		}
		if err = oprot.WriteFieldEnd(); err != nil {
			goto WriteFieldEndError
		}
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 12 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 12 end error: ", p), err)
}

func (p *OptionalDefaultValues) writeField13(oprot thrift.TProtocol) (err error) {
	if p.IsSetMapStringStringWithDefault() {
		if err = oprot.WriteFieldBegin("MapStringStringWithDefault", thrift.MAP, 13); err != nil {
			goto WriteFieldBeginError
		}
		if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.MapStringStringWithDefault)); err != nil {
			return err
		}
		for k, v := range p.MapStringStringWithDefault {
			if err := oprot.WriteString(k); err != nil {
				return err
			}
			if err := oprot.WriteString(v); err != nil {
				return err
			}
		}
		if err := oprot.WriteMapEnd(); err != nil {
			return err
		}
		if err = oprot.WriteFieldEnd(); err != nil {
			goto WriteFieldEndError
		}
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 13 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 13 end error: ", p), err)
}

func (p *OptionalDefaultValues) writeField14(oprot thrift.TProtocol) (err error) {
	if p.IsSetMapStringSimpleWithDefault() {
		if err = oprot.WriteFieldBegin("MapStringSimpleWithDefault", thrift.MAP, 14); err != nil {
			goto WriteFieldBeginError
		}
		if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRUCT, len(p.MapStringSimpleWithDefault)); err != nil {
			return err
		}
		for k, v := range p.MapStringSimpleWithDefault {
			if err := oprot.WriteString(k); err != nil {
				return err
			}
			if err := v.Write(oprot); err != nil {
				return err
			}
		}
		if err := oprot.WriteMapEnd(); err != nil {
			return err
		}
		if err = oprot.WriteFieldEnd(); err != nil {
			goto WriteFieldEndError
		}
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 14 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 14 end error: ", p), err)
}

func (p *OptionalDefaultValues) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("OptionalDefaultValues(%+v)", *p)

}
