github.com/insolar/vanilla@v0.0.0-20201023172447-248fdf805322/injector/lazy_name.go (about)

     1  // Copyright 2020 Insolar Network Ltd.
     2  // All rights reserved.
     3  // This material is licensed under the Insolar License version 1.0,
     4  // available at https://github.com/insolar/assured-ledger/blob/master/LICENSE.md.
     5  
     6  package injector
     7  
     8  import (
     9  	"reflect"
    10  )
    11  
    12  type lazyInjectName struct {
    13  	t reflect.Type
    14  	s string
    15  }
    16  
    17  func (p *lazyInjectName) String() string {
    18  	if p == nil || p.t == nil {
    19  		return ""
    20  	}
    21  	if p.s == "" {
    22  		p.s = GetDefaultInjectionIDByType(p.t)
    23  	}
    24  	return p.s
    25  }