CanResolve checks if a component with the given name is resolvable.
(name string)
| 252 | |
| 253 | // CanResolve checks if a component with the given name is resolvable. |
| 254 | func (d *DefaultContainer) CanResolve(name string) bool { |
| 255 | d.muSingletons.RLock() |
| 256 | defer d.muSingletons.RUnlock() |
| 257 | |
| 258 | if _, exists := d.singletons[name]; exists { |
| 259 | return true |
| 260 | } |
| 261 | |
| 262 | d.muDefinitions.RLock() |
| 263 | defer d.muDefinitions.RUnlock() |
| 264 | |
| 265 | if _, exists := d.definitions[name]; exists { |
| 266 | return true |
| 267 | } |
| 268 | |
| 269 | return false |
| 270 | } |
| 271 | |
| 272 | // CanResolveType checks if a component of the given type is resolvable. |
| 273 | func (d *DefaultContainer) CanResolveType(typ reflect.Type) bool { |
no outgoing calls