func (v *VersionedSegmentUnmarshalerGenerator) Generate() (io.Reader, error) {
	var versionedTemplateObjects []*segmentTemplateObject
	for _, version := range v.segment.Versions {
		fieldExtractor := &fieldExtractor{
			segment: version,
			file:    v.file,
			fileSet: v.fileSet,
		}
		sortedFields, err := fieldExtractor.extractFields()
		if err != nil {
			return nil, err
		}

		r, _ := utf8.DecodeRuneInString(version.Name)
		nameVar := string(unicode.ToLower(r))
		templObj := &segmentTemplateObject{
			Package:       v.packageName,
			Name:          version.Name,
			NameVar:       nameVar,
			InterfaceName: version.InterfaceName,
			Version:       version.Version,
			Fields:        sortedFields,
		}
		versionedTemplateObjects = append(versionedTemplateObjects, templObj)
	}
	r, _ := utf8.DecodeRuneInString(v.segment.Name)
	nameVar := string(unicode.ToLower(r))
	templObj := &segmentTemplateObject{
		Package:       v.packageName,
		Name:          v.segment.Name,
		NameVar:       nameVar,
		InterfaceName: v.segment.InterfaceName,
	}
	segmentTemplObj := &versionedSegmentTemplateObject{
		segmentTemplateObject: templObj,
		SegmentVersions:       versionedTemplateObjects,
	}

	executor := &versionedSegmentTemplateExecutor{segmentTemplObj}
	return executor.execute()
}
// Generate generates an unmarhsaler for the segment definition and provides it
// as an io.Reader
Generate generates an unmarhsaler for the segment definition and provides it
as an io.Reader
// Generate generates an unmarhsaler for the segment definition and provides it // as an io . Reader
func (v *VersionedSegmentUnmarshalerGenerator) Generate() (io.Reader, error) {
	var versionedTemplateObjects []*segmentTemplateObject
	for _, version := range v.segment.Versions {
		fieldExtractor := &fieldExtractor{
			segment: version,
			file:    v.file,
			fileSet: v.fileSet,
		}
		sortedFields, err := fieldExtractor.extractFields()
		if err != nil {
			return nil, err
		}
		r, _ := utf8.DecodeRuneInString(version.Name)
		nameVar := string(unicode.ToLower(r))
		templObj := &segmentTemplateObject{
			Package:       v.packageName,
			Name:          version.Name,
			NameVar:       nameVar,
			InterfaceName: version.InterfaceName,
			Version:       version.Version,
			Fields:        sortedFields,
		}
		versionedTemplateObjects = append(versionedTemplateObjects, templObj)
	}
	r, _ := utf8.DecodeRuneInString(v.segment.Name)
	nameVar := string(unicode.ToLower(r))
	templObj := &segmentTemplateObject{
		Package:       v.packageName,
		Name:          v.segment.Name,
		NameVar:       nameVar,
		InterfaceName: v.segment.InterfaceName,
	}
	segmentTemplObj := &versionedSegmentTemplateObject{
		segmentTemplateObject: templObj,
		SegmentVersions:       versionedTemplateObjects,
	}
	executor := &versionedSegmentTemplateExecutor{segmentTemplObj}
	return executor.execute()
}
func ( v * VersionedSegmentUnmarshalerGenerator ) Generate ( ) ( io . Reader , error ) { var versionedTemplateObjects [ ] * segmentTemplateObject for _ , version := range v . segment . Versions { fieldExtractor := & fieldExtractor { segment : version , file : v . file , fileSet : v . fileSet , } sortedFields , err := fieldExtractor . extractFields ( ) if err != nil { return nil , err } r , _ := utf8 . DecodeRuneInString ( version . Name ) nameVar := string ( unicode . ToLower ( r ) ) templObj := & segmentTemplateObject { Package : v . packageName , Name : version . Name , NameVar : nameVar , InterfaceName : version . InterfaceName , Version : version . Version , Fields : sortedFields , } versionedTemplateObjects = append ( versionedTemplateObjects , templObj ) } r , _ := utf8 . DecodeRuneInString ( v . segment . Name ) nameVar := string ( unicode . ToLower ( r ) ) templObj := & segmentTemplateObject { Package : v . packageName , Name : v . segment . Name , NameVar : nameVar , InterfaceName : v . segment . InterfaceName , } segmentTemplObj := & versionedSegmentTemplateObject { segmentTemplateObject : templObj , SegmentVersions : versionedTemplateObjects , } executor := & versionedSegmentTemplateExecutor { segmentTemplObj } return executor . execute ( ) }
Generate generates an unmarhsaler for the segment definition and provides it
as an io.Reader
Generate generates an unmarhsaler for the segment definition and provides it as an io . Reader