public provide()

in lib/object-provider.ts [155:176]


    public provide(uri: Uri | Uri[], context?: ObjectContext): any {
        let protocol: string;
        if (Array.isArray(uri)) {
            if ((<Uri[]>uri).length == 0) {
                return null;
            }
            protocol = (<Uri[]>uri)[0].protocol;
            for (let item of uri) {
                if (item.protocol !== protocol) {
                    throw new Error("Protocol must the the same with an array of Uris when calling ObjectContext.create.");
                }
            }
        }
        else {
            protocol = (<Uri>uri).protocol;
        }
        let lowerCaseProtocol = protocol.toLowerCase();
        if (this.supports(lowerCaseProtocol)) {
            return this._protocolToProviderMethod.get(lowerCaseProtocol)(uri, context);
        }
        throw new Error("Unsupported protocol '" + protocol + "'.");
    }