class InjectorFactory {

  public <R> TraceContext.Injector<R> newInjector(Setter<R, String> setter) {
    if (setter == null) throw new NullPointerException("setter == null");
    if (setter instanceof RemoteSetter) {
      RemoteSetter<?> remoteSetter = (RemoteSetter<?>) setter;
      switch (remoteSetter.spanKind()) {
        case CLIENT:
          return new RemoteInjector<>(setter, clientInjectorFunction);
        case PRODUCER:
          return new RemoteInjector<>(setter, producerInjectorFunction);
        case CONSUMER:
          return new RemoteInjector<>(setter, consumerInjectorFunction);
        default: // SERVER is nonsense as it cannot be injected
      }
    }
    return new DeferredInjector<>(setter, this);
  }

    InjectorFactory(Builder builder);

}