github.com/metux/go-metabuild@v0.0.0-20240118143255-d9ed5ab697f9/util/specobj/proxy.go (about) 1 package specobj 2 3 // implementation of proxy to the magicdict.Entry interface 4 5 import ( 6 magic "github.com/metux/go-magicdict" 7 ) 8 9 func (so SpecObj) Get(k Key) (Entry, error) { 10 if so.Spec == nil { 11 return nil, magic.ErrNilInterface 12 } 13 return so.Spec.Get(k) 14 } 15 16 func (so SpecObj) Put(k Key, value Entry) error { 17 if so.Spec == nil { 18 return magic.ErrNilInterface 19 } 20 return so.Spec.Put(k, value) 21 } 22 23 func (so SpecObj) Keys() magic.KeyList { 24 if so.Spec == nil { 25 return magic.KeyList{} 26 } 27 return so.Spec.Keys() 28 } 29 30 func (so SpecObj) Elems() magic.EntryList { 31 if so.Spec == nil { 32 return magic.EntryList{} 33 } 34 return so.Spec.Elems() 35 } 36 37 func (so SpecObj) Empty() bool { 38 if so.Spec == nil { 39 return true 40 } 41 return so.Spec.Empty() 42 } 43 44 func (so SpecObj) String() string { 45 if so.Spec == nil { 46 return "" 47 } 48 return so.Spec.String() 49 } 50 51 func (so SpecObj) IsConst() bool { 52 if so.Spec == nil { 53 return false 54 } 55 return so.Spec.IsConst() 56 } 57 58 func (so SpecObj) MayMergeDefaults() bool { 59 if so.Spec == nil { 60 return false 61 } 62 return so.Spec.MayMergeDefaults() 63 } 64 65 func (so SpecObj) IsScalar() bool { 66 if so.Spec == nil { 67 return false 68 } 69 return so.Spec.IsScalar() 70 }