Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
hutcheb committed Nov 14, 2024
2 parents 3df9c5b + f60e895 commit d700efa
Show file tree
Hide file tree
Showing 2,408 changed files with 25,197 additions and 30,784 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,15 +353,25 @@ type ${type.name}Builder interface {
With<#if field.isOptionalField()>Optional</#if>${field.name?cap_first}Builder(func(${helper.getLanguageTypeNameForTypeReference(typeRef)}Builder)${helper.getLanguageTypeNameForTypeReference(typeRef)}Builder) ${type.name}Builder
</#if>
</#list>
<#if filteredParserArgumentsLocalToType?has_content>
<#list filteredParserArgumentsLocalToType as parserArgument>
// WithArg${parserArgument.name?cap_first} sets a parser argument
WithArg${parserArgument.name?cap_first}(${helper.getLanguageTypeNameForTypeReference(parserArgument.type)}) ${type.name}Builder
</#list>
</#if>
<#if type.isAbstract()>
<#list type.switchField.orElseThrow().cases as case>
// As${case.name} converts this build to a subType of ${type.name}. It is always possible to return to current builder using Done()
As${case.name}() interface{${case.name}Builder;Done()${type.name}Builder}
As${case.name}() ${case.name}Builder
</#list>
// Build builds the ${type.name} or returns an error if something is wrong
PartialBuild() (${type.name}Contract,error)
// MustBuild does the same as Build but panics on error
PartialMustBuild() ${type.name}Contract
</#if>
<#if type.isDiscriminatedChildTypeDefinition()>
// Done is used to finish work on this child and return (or create one if none) to the parent builder
Done() (${type.parentType.orElseThrow().name}Builder)
</#if>
// Build builds the ${type.name} or returns an error if something is wrong
Build() (${type.name},error)
Expand Down Expand Up @@ -402,6 +412,7 @@ var _ (${type.name}Builder) = (*_${type.name}Builder)(nil)
<#assign parentType=type.getParentType().orElseThrow()>
func (b *_${type.name}Builder) setParent(contract ${parentType.name}Contract) {
b.${parentType.name}Contract = contract
contract.(*_${parentType.name})._SubType = b._${type.name}
}
</#if>

Expand Down Expand Up @@ -448,6 +459,15 @@ func (b *_${type.name}Builder) With<#if field.isOptionalField()>Optional</#if>${
</#if>
</#list>

<#if filteredParserArgumentsLocalToType?has_content>
<#list filteredParserArgumentsLocalToType as parserArgument>
func (b *_${type.name}Builder) WithArg${parserArgument.name?cap_first}(${parserArgument.name} ${helper.getLanguageTypeNameForTypeReference(parserArgument.type)}) ${type.name}Builder {
b.${parserArgument.name?cap_first} = ${parserArgument.name}
return b
}
</#list>
</#if>

func (b *_${type.name}Builder) <#if type.isAbstract()>Partial</#if>Build() (${type.name}<#if type.isAbstract()>Contract</#if>,error) {
<#list type.propertyFields?filter(field->!field.isOptionalField()) as field>
<#if field.type.isComplexTypeReference() || helper.needsPointerAccess(field)>
Expand Down Expand Up @@ -475,8 +495,8 @@ func (b *_${type.name}Builder) <#if type.isAbstract()>Partial</#if>MustBuild() $

<#if type.isAbstract()>
<#list type.switchField.orElseThrow().cases as case>
func (b *_${type.name}Builder) As${case.name}() interface{${case.name}Builder;Done()${type.name}Builder} {
if cb, ok := b.childBuilder.(interface{${case.name}Builder;Done()${type.name}Builder}); ok {
func (b *_${type.name}Builder) As${case.name}() ${case.name}Builder {
if cb, ok := b.childBuilder.(${case.name}Builder); ok {
return cb
}
cb := New${case.name}Builder().(*_${case.name}Builder)
Expand All @@ -491,8 +511,10 @@ func (b *_${type.name}Builder) As${case.name}() interface{${case.name}Builder;Do
<#if type.isDiscriminatedChildTypeDefinition()>
<#assign parentType=type.getParentType().orElseThrow()>

// Done is used to finish work on this child and return to the parent builder
func (b *_${type.name}Builder) Done() ${parentType.name}Builder {
if b.parentBuilder == nil {
b.parentBuilder = New${parentType.name}Builder().(*_${parentType.name}Builder)
}
return b.parentBuilder
}

Expand Down Expand Up @@ -1873,7 +1895,7 @@ func (m *_${type.name}) deepCopy() *_${type.name} {
<#if type.propertyFields?has_content>
<#list type.propertyFields as field>
<#if field.type.isComplexTypeReference()>
m.${field.name?cap_first}.DeepCopy().(<#if helper.needsPointerAccess(field)>*</#if>${helper.getLanguageTypeNameForTypeReference(field.type)}),
utils.DeepCopy[<#if helper.needsPointerAccess(field)>*</#if>${helper.getLanguageTypeNameForTypeReference(field.type)}](m.${field.name?cap_first}),
<#elseif field.type.isArrayTypeReference()>
<#assign arrayElementTypeRef=field.type.asArrayTypeReference().orElseThrow().elementTypeReference/>
utils.DeepCopySlice[${helper.getLanguageTypeNameForTypeReference(arrayElementTypeRef)}, ${helper.getLanguageTypeNameForTypeReference(arrayElementTypeRef)}](m.${field.name?cap_first}),
Expand All @@ -1895,7 +1917,7 @@ func (m *_${type.name}) deepCopy() *_${type.name} {
</#if>
}
<#if type.isDiscriminatedChildTypeDefinition()>
m.${type.parentType.orElseThrow().name}Contract.(*_${type.parentType.orElseThrow().name})._SubType = m
_${type.name}Copy.${type.parentType.orElseThrow().name}Contract.(*_${type.parentType.orElseThrow().name})._SubType = m
</#if>
return _${type.name}Copy
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 12 additions & 48 deletions plc4go/protocols/abeth/readwrite/model/CIPEncapsulationPacket.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d700efa

Please sign in to comment.