};
protected Optional<URI> getEndpointFor(Invocation invocation) {
URI endpoint = getEndpointInParametersOrNull(invocation, injector);
if (endpoint == null) {
Endpoint annotation;
if (invocation.getInvokable().isAnnotationPresent(Endpoint.class)) {
annotation = invocation.getInvokable().getAnnotation(Endpoint.class);
} else if (invocation.getInvokable().getOwnerType().getRawType().isAnnotationPresent(Endpoint.class)) {
annotation = invocation.getInvokable().getOwnerType().getRawType().getAnnotation(Endpoint.class);
} else {
logger.trace("no annotations on class or invocation.getInvoked(): %s", invocation.getInvokable());
return Optional.absent();
}
endpoint = injector.getInstance(Key.get(uriSupplierLiteral, annotation.value())).get();
}
URI provider = injector.getInstance(Key.get(uriSupplierLiteral, org.jclouds.location.Provider.class)).get();
return Optional.fromNullable(addHostIfMissing(endpoint, provider));
}