Function locate
Given a locator, locates an object and attempts to convert to T type.
auto ref auto locate(T)
(
Locator!(Object,string) locator,
string id
) @trusted;
auto ref auto locate(T)
(
Locator!(Object,string) locator,
string id
) @trusted
if (is(T == interface));
auto ref auto locate(T)
(
Locator!(Object,string) locator,
string id
) @trusted
if (!is(T == interface));
auto ref auto locate(T)
(
Locator!(Object,string) locator
) @trusted;
Given a locator, locates an object and attempts to convert to T type. When an object of T type is located, it is simply casted to T type. When an value of T type is located, the func attempts to cast the requested object to Wrapper!T, and will return it, instead of T directly. In case of failure an InvalidCastException is thrown in debug environment.
Parameters
Name | Description |
---|---|
locator | the locator that contains the data with id as identity |
id | identity of object contained in locator |
Throws
InvalidCastException in debug mode when actual type of object is not of type that is requested.
Returns
Object casted to desired type.