Loop through all of the endpoint instances' public singleton methods to
 add the method to client
558890
def create_methods_from_instance(instance)
      instance.public_methods(false).each do |method_name|
        add_method(instance, method_name)
      end
    end
265949
@EachBean(ServiceHttpClientConfiguration.class)
    @Requires(condition = ServiceHttpClientCondition.class)
    StaticServiceInstanceList serviceInstanceList(ServiceHttpClientConfiguration configuration) {
        List<URI> originalURLs = configuration.getUrls();
        Collection<URI> loadBalancedURIs = new ConcurrentLinkedQueue<>(originalURLs);
        return new StaticServiceInstanceList(configuration.getServiceId(), loadBalancedURIs);
    }
578303
def _startup(cls):
        
        for endpoint_name in sorted(hookenv.relation_types()):
            # populate context based on attached relations
            relf = relation_factory(endpoint_name)
            if not relf or not issubclass(relf, cls):
                continue

            rids = sorted(hookenv.relation_ids(endpoint_name))
            # ensure that relation IDs have the endpoint name prefix, in case
            # juju decides to drop it at some point
            rids = ['{}:{}'.format(endpoint_name, rid) if ':' not in rid
                    else rid for rid in rids]
            endpoint = relf(endpoint_name, rids)
            cls._endpoints[endpoint_name] = endpoint
            endpoint.register_triggers()
            endpoint._manage_departed()
            endpoint._manage_flags()
            for relation in endpoint.relations:
                hookenv.atexit(relation._flush_data)
98585
def +(other)
      config = clone
      specs = other.spec.to_h
      specs.each { |key, val| config[key] = val }
      methods = other.spec.singleton_methods
      methods.map! { |name| name.to_s.tr('=', '').to_sym }
      methods.uniq!
      methods -= specs.keys
      methods.each do |name|
        config.spec.define_singleton_method(name) do
          other.spec.public_method(name).call
        end
        config.instance_variable_get(:@lazy_loads) << name
      end
      config
    end
203506
private static <E> E getEndpoint(Class<E> type, String name, Reflections reflections) {
        E result = null;

        // Get concrete subclasses:
        Set<Class<? extends E>> foundClasses = reflections.getSubTypesOf(type);
        Set<Class<? extends E>> endpointClasses = new HashSet<>();
        for (Class<? extends E> clazz : foundClasses) {
            if (!Modifier.isAbstract(clazz.getModifiers())) {
                endpointClasses.add(clazz);
            }
        }

        // Filter out any default routes:
        //log.info("Filtering " + type.getName());
        Iterator<Class<? extends E>> iterator = endpointClasses.iterator();
        while (iterator.hasNext()) {
            Class<? extends E> next = iterator.next();
            if (StringUtils.startsWithIgnoreCase(next.getName(), "com.github.davidcarboni.restolino.routes.")) {
                //log.info("Filtered out " + next.getName());
                iterator.remove();
            } //else {
            //log.info("Filtered in " + next.getName());
            //}
        }
        //log.info("Filtered.");

        if (endpointClasses.size() != 0) {

            // Dump multiple endpoints:
            if (endpointClasses.size() > 1) {
                log.info("Warning: found multiple candidates for {} endpoint: {}", name, endpointClasses);
            }

            // Instantiate the endpoint if possible:
            try {
                result = endpointClasses.iterator().next().newInstance();
            } catch (Exception e) {
                log.info("Error: cannot instantiate {} endpoint class {}",name, endpointClasses.iterator().next());
                e.printStackTrace();
            }
        }

        return result;
    }
409553
private void addEndpoint(String addr, Own endpoint, Pipe pipe)
    {
        //  Activate the session. Make it a child of this socket.
        launchChild(endpoint);
        endpoints.insert(addr, new EndpointPipe(endpoint, pipe));
    }
159717
def bind(client)
      if self.class.const_defined?(:WithClient)
        mod = self.class.const_get(:WithClient)
      else
        mod = Page::WithClient
      end
      unless singleton_class.include?(mod)
        extend(mod)
      end
      self.client = client
      self
    end
605032
public static ClientConfiguration createClient(final List<Endpoint> endpoints, final List<DataProvider> providers) {
        return createClient(null, null, endpoints, providers);
    }
1091003
public ListInstancesResponse listInstances(ListInstancesRequest request) {
        checkNotNull(request, "request should not be null.");
        InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, INSTANCE_PREFIX);
        if (request.getMarker() != null) {
            internalRequest.addParameter("marker", request.getMarker());
        }
        if (request.getMaxKeys() > 0) {
            internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys()));
        }
        if (!Strings.isNullOrEmpty(request.getInternalIp())) {
            internalRequest.addParameter("internalIp", request.getInternalIp());
        }
        if (!Strings.isNullOrEmpty(request.getDedicatedHostId())) {
            internalRequest.addParameter("dedicatedHostId", request.getDedicatedHostId());
        }
        if (!Strings.isNullOrEmpty(request.getZoneName())) {
            internalRequest.addParameter("zoneName", request.getZoneName());
        }
        return invokeHttpClient(internalRequest, ListInstancesResponse.class);
    }
1232091
function ApiClient(endpoint) {
    if (endpoint.length > 0 && endpoint.slice(-1) != "/") {
        endpoint += "/";
    }
    
    this.endpoint = endpoint;
    this.namespace = null;
}
525919
private static Endpoint initServiceEndpoint(EndpointRegistry epRegistry, String contextPath, String servletName)
   {
      if (contextPath.startsWith("/"))
         contextPath = contextPath.substring(1);

      final ObjectName oname = ObjectNameFactory.create(Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_CONTEXT
            + "=" + contextPath + "," + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName);
      Endpoint endpoint = epRegistry.getEndpoint(oname);
      if (endpoint == null)
      {
         throw Messages.MESSAGES.cannotObtainEndpoint(oname);
      }

      //Inject the EJB and JNDI resources if possible
      injectServiceAndHandlerResources(endpoint);

      return endpoint;
   }
820060
function (method, endpoint, routerMiddelware) {
		var self = this;

		if (typeof routerMiddelware == 'object'){
			this.app[method](endpoint, function (req, res, next) {
				var middlewareFunction = []
				routerMiddelware.forEach(function (m) {
					middlewareFunction.push(function (cb) {
						self.__exec__middlewares(m, req, res, cb);
					});
				});

				async.waterfall(middlewareFunction);
			});
		} else {
			this.app[method](endpoint, function (req, res, next) {
				self.__exec__middleware(routerMiddelware)(req, res, next);
			});
		}
	}
1336458
def define_methods_into(client)
      links.each do |link|
        @client.define_singleton_method(link.method_signature) do |params = {}, headers = {}|
          Request.call(client: client, headers: headers, link: link, params: params)
        end
      end
    end
995208
function loadEndpoints(endpoints, options, auth) {
	if (Array.isArray(endpoints)) {
		endpoints.forEach(function(endpoint) {
			if (auth !== Boolean(endpoint.authenticated)) {
				//after endpoints refactored, remove this check
				return;
			}
			const conditional = endpoint.hasOwnProperty("ifProp");
			if (conditional && options.configParams.get(endpoint.ifProp) || !conditional) {
				tryLoadRouter(endpoint, options);
			}
		});
	}
}
91807
function instanceMethod(method) {
		return function (req, res, next) {

			var done = function (err, data) {
				if (err) {
					return res.status(400).send(err);
				}
				return res.send(data);
			};

			var id = req.params.id;
			if (id) {
				Model.findById(id, function (err, data) {
					if (err) {
						debug('Method middleware Model.findById error:', err);
						return next(err);
					}
					if (data) {
						data[method](req, res, done, next);
					} else {
						return res.status(404).send();
					}
				});
			} else {
				return res.status(404).send();
			}
		};
	}
537763
function() {
    var objKeys = []
    var self = this

    this.use(function() {
      // get all current property names
      objKeys = Object.keys(this)
    }, 90)

    this.on('finished', function() {
      // an now search for new ones ==> instance methods for our new model class

      Object.keys(self).forEach(function(name) {
        if (objKeys.indexOf(name) === -1) {
          self.instanceMethods[name] = self[name]
          delete self[name]
        }
      })
    })
  }
877113
def init_proxies
      singleton = class << self; self end
      @contract.interfaces.each do |iface|
        proxy = InterfaceProxy.new(self, iface)
        singleton.send :define_method, iface.name do
          return proxy
        end
      end
    end