// NewSetPortableClassItems returns a NewMethod that writes a
// SetPortableClassItems method for the supplied Object to the supplied file.
NewSetPortableClassItems returns a NewMethod that writes a
SetPortableClassItems method for the supplied Object to the supplied file.
// NewSetPortableClassItems returns a NewMethod that writes a // SetPortableClassItems method for the supplied Object to the supplied file .
func NewSetPortableClassItems(receiver, resource string) New {
	return func(f *jen.File, o types.Object) {
		element := strings.TrimSuffix(o.Name(), "List")
		f.Commentf("SetPortableClassItems of this %s.", o.Name())
		f.Func().Params(jen.Id(receiver).Op("*").Id(o.Name())).Id("SetPortableClassItems").Params(jen.Id("i").Index().Qual(resource, "PortableClass")).Block(
			jen.Id(receiver).Dot("Items").Op("=").Make(jen.Index().Id(element), jen.Id("0"), jen.Len(jen.Id("i"))),
			jen.For(jen.Id("j").Op(":=").Range().Id("i")).Block(
				jen.If(jen.List(jen.Id("actual"), jen.Id("ok")).Op(":=").Id("i").Index(jen.Id("j")).Assert(jen.Op("*").Id(element)), jen.Id("ok")).Block(
					jen.Id(receiver).Dot("Items").Op("=").Append(jen.Id(receiver).Dot("Items"), jen.Op("*").Id("actual")),
				),
			),
		)
	}
}
func NewSetPortableClassItems ( receiver , resource string ) New { return func ( f * jen . File , o types . Object ) { element := strings . TrimSuffix ( o . Name ( ) , " " ) f . Commentf ( " " , o . Name ( ) ) f . Func ( ) . Params ( jen . Id ( receiver ) . Op ( " " ) . Id ( o . Name ( ) ) ) . Id ( " " ) . Params ( jen . Id ( " " ) . Index ( ) . Qual ( resource , " " ) ) . Block ( jen . Id ( receiver ) . Dot ( " " ) . Op ( " " ) . Make ( jen . Index ( ) . Id ( element ) , jen . Id ( " " ) , jen . Len ( jen . Id ( " " ) ) ) , jen . For ( jen . Id ( " " ) . Op ( " " ) . Range ( ) . Id ( " " ) ) . Block ( jen . If ( jen . List ( jen . Id ( " " ) , jen . Id ( " " ) ) . Op ( " " ) . Id ( " " ) . Index ( jen . Id ( " " ) ) . Assert ( jen . Op ( " " ) . Id ( element ) ) , jen . Id ( " " ) ) . Block ( jen . Id ( receiver ) . Dot ( " " ) . Op ( " " ) . Append ( jen . Id ( receiver ) . Dot ( " " ) , jen . Op ( " " ) . Id ( " " ) ) , ) , ) , ) } }
NewSetPortableClassItems returns a NewMethod that writes a
SetPortableClassItems method for the supplied Object to the supplied file.
NewSetPortableClassItems returns a NewMethod that writes a SetPortableClassItems method for the supplied Object to the supplied file .