Creates a {@link Builder} for creating instance of {@link ThriftRPCServer}.
@param serviceType Class of the thrift service.
@param <I> Type of the thrift service.
@return A {@link Builder}.
510805
public static <I> Builder<I> builder(Class<I> serviceType) {
    return new Builder<I>(serviceType);
  }
1148416
public <S> ServiceBinder<S> bindServices(final Class<S> type) {
        ServiceBinderImpl<S> binder = new ServiceBinderImpl<S>(type);
        binders.add(binder);
        return binder;
    }
694790
@SuppressWarnings("unchecked")
   private <T> T loadService(Class<T> spiType, Class<?> defaultImpl, ClassLoader loader)
   {
      final String defaultImplName = defaultImpl != null ? defaultImpl.getName() : null;
      return (T)ServiceLoader.loadService(spiType.getName(), defaultImplName, loader);
   }
739667
public static final <T> AsyncResultImpl<T> create(Throwable t, Class<T> type) {
        return new AsyncResultImpl<>(t);
    }
1246985
@Override
    public <T> List<T> getServices(final Class<T> serviceType) {
        @SuppressWarnings("unchecked")
        List<T> found = (List<T>) servicesLoaded.get(serviceType);
        if (found != null) {
            return found;
        }

        return loadServices(serviceType);
    }
651390
public TypeUsage.Builder type(QualifiedName type) {
    this.type = Objects.requireNonNull(type);
    _unsetProperties.remove(Property.TYPE);
    return (TypeUsage.Builder) this;
  }
578662
public static RequestOptions.RequestOptionsBuilder builder(
            @Nullable String publishableApiKey,
            @NonNull @RequestType String requestType) {
        return new RequestOptions.RequestOptionsBuilder(
                publishableApiKey,
                requestType);
    }
457288
@Override
	public ThriftServer getThriftServer(int serverPort, Service service) {
		return getThriftServer(String.format("ThriftServer-%d", serverPort), serverPort, service);
	}
1229389
@Override
    public PortletURLProvider getPortletURLProvider(TYPE type) {
        final IPortletWindowId portletWindowId = this.portletWindow.getPortletWindowId();
        final UrlType urlType = UrlType.fromPortletUrlType(type);
        final IPortalUrlBuilder portalUrlBuilder =
                this.portalUrlProvider.getPortalUrlBuilderByPortletWindow(
                        containerRequest, portletWindowId, urlType);
        final IPortletUrlBuilder portletUrlBuilder =
                portalUrlBuilder.getPortletUrlBuilder(portletWindowId);
        return new PortletURLProviderImpl(portletUrlBuilder);
    }
89311
public static <K, V> UserManagedCacheBuilder<K, V, UserManagedCache<K, V>> newUserManagedCacheBuilder(Class<K> keyType, Class<V> valueType) {
    return new UserManagedCacheBuilder<>(keyType, valueType);
  }
772455
@Override
    public <T> PluggableProviderService<T> createPluginService(Class<T> type, final String serviceName) {
        //load provider service implementation via java ServiceLoader if available
        PluggableProviderService<T> pluginProviderService = ServiceTypes.getPluginProviderService(type, serviceName, this);
        if (null != pluginProviderService) {
            return pluginProviderService;
        }

        //otherwise construct default service implementation
        BasePluginProviderService<T> basePluginProviderService = new BasePluginProviderService<T>(
                serviceName,
                type
        );
        basePluginProviderService.setRundeckServerServiceProviderLoader(this);
        return basePluginProviderService;
    }
163933
@SuppressWarnings("unchecked") // types must agree
  public static <T> T createMockObject(Type type) {
    Class<T> rawType;

    if (type instanceof ParameterizedType) {
      rawType = (Class<T>) ((ParameterizedType) type).getRawType();
    } else if (type instanceof Class) {
      rawType = (Class<T>) type;
    } else {
      throw new UnsupportedOperationException("Unsupported type: "
          + type.getClass().getSimpleName());
    }
    T instance = instantiateObject(rawType);

    return populateObject(instance);
  }
716073
@Override
	public ThriftServer getThriftServer(String serverName, int serverPort, Service service) {
		return getThriftServer(serverName, serverPort, new ServiceProcessor(service));
	}
1123388
public static <T extends Annotation> T create(Class<T> annotationType) {
    return new Builder<T>(annotationType).create();
  }
533037
public PrimaryBackupSessionClient.Builder sessionBuilder(String primitiveName, PrimitiveType primitiveType, ServiceConfig serviceConfig) {
    byte[] configBytes = Serializer.using(primitiveType.namespace()).encode(serviceConfig);
    return new PrimaryBackupSessionClient.Builder() {
      @Override
      public SessionClient build() {
        Supplier<CompletableFuture<SessionClient>> proxyBuilder = () -> sessionIdService.nextSessionId()
            .thenApply(sessionId -> new PrimaryBackupSessionClient(
                clientName,
                partitionId,
                sessionId,
                primitiveType,
                new PrimitiveDescriptor(
                    primitiveName,
                    primitiveType.name(),
                    configBytes,
                    numBackups,
                    replication),
                clusterMembershipService,
                PrimaryBackupClient.this.protocol,
                primaryElection,
                threadContextFactory.createContext()));

        SessionClient proxy;
        ThreadContext context = threadContextFactory.createContext();
        if (recovery == Recovery.RECOVER) {
          proxy = new RecoveringSessionClient(
              clientName,
              partitionId,
              primitiveName,
              primitiveType,
              proxyBuilder,
              context);
        } else {
          proxy = Futures.get(proxyBuilder.get());
        }

        // If max retries is set, wrap the client in a retrying proxy client.
        if (maxRetries > 0) {
          proxy = new RetryingSessionClient(
              proxy,
              context,
              maxRetries,
              retryDelay);
        }
        return new BlockingAwareSessionClient(proxy, context);
      }
    };
  }
1172274
public static <X> ServiceTypeLoader<X> load(Class<X> serviceType) {
        return load(serviceType, Thread.currentThread().getContextClassLoader());
    }
637094
public static <T extends Descriptor> T create(final Class<T> type) throws IllegalArgumentException {
        return create(type, null);
    }