tschneidereit / SwiftSuspenders

NOTE: Find the offical repo at http://github.com/robotlegs/swiftsuspenders
https://github.com/robotlegs/swiftsuspenders
MIT License
280 stars 89 forks source link

getMapping throws error (2.0.0b1) #60

Closed darscan closed 12 years ago

darscan commented 12 years ago

How can one query for the existence of a mapping? Calling getMapping() throws and error if no mapping is found. I would expect it to return null, or for a method called hasMapping() to be exposed.

tschneidereit commented 12 years ago

Mmh, I might have to work on my API, then. The injector has the methods satisfies and satisfiesDirectly, the first of which most likely is what you want to use, whereas the second most likely is what you'd expect to be using.

The thing is that hasMapping wouldn't live up to its name if it returned true if the injector itself or one of its ancestors has a mapping, but that's what you want to know 99% of the time.

Got any good naming suggestions?

darscan commented 12 years ago

Ah! I didn't see satisfies(). That'll work for me.

tschneidereit commented 12 years ago

Cool. But do you think that I should use a better name for that functionality?

darscan commented 12 years ago

Nope, I like it.

tschneidereit commented 12 years ago

Alright then, documentation it is. Thanks.