Debian Codegraph @

pdata/xpdata/entity/generated_entityref.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 // Code generated by "internal/cmd/pdatagen/main.go". DO NOT EDIT.
5 // To regenerate this file run "make genpdata".
6
7 package entity
8
9 import (
10 "go.opentelemetry.io/collector/pdata/internal"
11 "go.opentelemetry.io/collector/pdata/pcommon"
12 )
13
14 // This is a reference type, if passed by value and callee modifies it the
15 // caller will see the modification.
16 //
17 // Must use NewEntityRef function to create new instances.
18 // Important: zero-initialized instance is not valid for use.
19 type EntityRef internal.EntityRefWrapper
20
21 func newEntityRef(orig *internal.EntityRef, state *internal.State) EntityRef {
22 return EntityRef(internal.NewEntityRefWrapper(orig, state))
23 }
24
25 // NewEntityRef creates a new empty EntityRef.
26 //
27 // This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice,
28 // OR directly access the member if this is embedded in another struct.
29 func NewEntityRef() EntityRef {
30 return newEntityRef(internal.NewEntityRef(), internal.NewState())
31 }
32
33 // MoveTo moves all properties from the current struct overriding the destination and
34 // resetting the current instance to its zero value
35 func (ms EntityRef) MoveTo(dest EntityRef) {
36 ms.getState().AssertMutable()
37 dest.getState().AssertMutable()
38 // If they point to the same data, they are the same, nothing to do.
39 if ms.getOrig() == dest.getOrig() {
40 return
41 }
42 internal.DeleteEntityRef(dest.getOrig(), false)
43 *dest.getOrig(), *ms.getOrig() = *ms.getOrig(), *dest.getOrig()
44 }
45
46 // SchemaUrl returns the schemaurl associated with this EntityRef.
47 func (ms EntityRef) SchemaUrl() string {
48 return ms.getOrig().SchemaUrl
49 }
50
51 // SetSchemaUrl replaces the schemaurl associated with this EntityRef.
52 func (ms EntityRef) SetSchemaUrl(v string) {
53 ms.getState().AssertMutable()
54 ms.getOrig().SchemaUrl = v
55 }
56
57 // Type returns the type associated with this EntityRef.
58 func (ms EntityRef) Type() string {
59 return ms.getOrig().Type
60 }
61
62 // SetType replaces the type associated with this EntityRef.
63 func (ms EntityRef) SetType(v string) {
64 ms.getState().AssertMutable()
65 ms.getOrig().Type = v
66 }
67
68 // IdKeys returns the IdKeys associated with this EntityRef.
69 func (ms EntityRef) IdKeys() pcommon.StringSlice {
70 return pcommon.StringSlice(internal.NewStringSliceWrapper(&ms.getOrig().IdKeys, ms.getState()))
71 }
72
73 // DescriptionKeys returns the DescriptionKeys associated with this EntityRef.
74 func (ms EntityRef) DescriptionKeys() pcommon.StringSlice {
75 return pcommon.StringSlice(internal.NewStringSliceWrapper(&ms.getOrig().DescriptionKeys, ms.getState()))
76 }
77
78 // CopyTo copies all properties from the current struct overriding the destination.
79 func (ms EntityRef) CopyTo(dest EntityRef) {
80 dest.getState().AssertMutable()
81 internal.CopyEntityRef(dest.getOrig(), ms.getOrig())
82 }
83
84 func (ms EntityRef) getOrig() *internal.EntityRef {
85 return internal.GetEntityRefOrig(internal.EntityRefWrapper(ms))
86 }
87
88 func (ms EntityRef) getState() *internal.State {
89 return internal.GetEntityRefState(internal.EntityRefWrapper(ms))
90 }