Create
@param type
@param serviceName
@param <T>
@return
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;
    }
566614
public Result<T> put(T service)
    {
        check(service);

        ServiceType serviceType = service.resolveServiceType();
        T previous = null;

        lock();
        try
        {
            ServiceType existingServiceType = keysToServiceTypes.get(service.getKey());
            if (existingServiceType != null && !existingServiceType.equals(serviceType))
                throw new ServiceLocationException("Invalid registration of service " + service.getKey() +
                                                   ": already registered under service type " + existingServiceType +
                                                   ", cannot be registered also under service type " + serviceType, SLPError.INVALID_REGISTRATION);
            keysToServiceTypes.put(service.getKey(), serviceType);
            previous = keysToServiceInfos.put(service.getKey(), service);
            service.setRegistered(true);
            if (previous != null) previous.setRegistered(false);
        }
        finally
        {
            unlock();
        }

        notifyServiceAdded(previous, service);
        return new Result<T>(previous, service);
    }
955135
@SuppressWarnings("unchecked")
    public static <T> T getService(Class<T> type) {
        Bundle serviceBundle = FrameworkUtil.getBundle(type);
        BundleContext serviceBundleContext = serviceBundle.getBundleContext();
        ServiceReference serviceReference = serviceBundleContext.getServiceReference(type.getName());
        return (T) serviceBundleContext.getService(serviceReference);
    }
907245
@SuppressWarnings("unchecked")
    @Override
    public <T> T create(EntityCreateOperation<T> creator)
            throws ServiceException {
        creator.setProxyData(createProxyData());
        Object rawResponse = getResource(creator).post(
                creator.getResponseClass(), creator.getRequestContents());
        Object processedResponse = creator.processResponse(rawResponse);
        return (T) processedResponse;
    }
141656
protected T create (Kryo kryo, Input input, Class<? extends T> type) {
		return kryo.newInstance(type);
	}
919388
@NonNull
  public static CreateTypeStart createType(
      @Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier typeName) {
    return new DefaultCreateType(keyspace, typeName);
  }
557865
public static TLVElement create(int type, byte[] value) throws TLVParserException {
        TLVElement element = create(type);
        element.setContent(value);
        return element;
    }
654300
public static <T> Reference<T> create(ReferenceType type, T referent) {
		return create(type, referent, null);
	}
1181273
public static byte[] toPacket(final ServiceType type)
	{
		final KNXnetIPHeader h = new KNXnetIPHeader(type.svcType, type.getStructLength());
		final ByteArrayOutputStream os = new ByteArrayOutputStream(h.getTotalLength());
		os.write(h.toByteArray(), 0, h.getStructLength());
		return type.toByteArray(os);
	}
1286453
public <T> T createInstance(DatastoreType datastoreType, DynamicType<?> types) {
        return newInstance(getDatastoreId(datastoreType), datastoreType, types, TransactionalCache.Mode.WRITE);
    }
858762
static WebServiceRef createWebServiceRefFromResource(Resource resource, Class<?> typeClass, String jndiName) throws InjectionException {
        // notice we send in 'Service.class' for the 'value' attribute, this is
        // because only service type injections are possible with the @Resource
        // annotation, so we'll use the default value for the 'value' attribute.
        return new WebServiceRefSimulator(resource.mappedName(), jndiName, typeClass, Service.class, null, "");
    }
537567
def create(self, service_name, json, **kwargs):
        """"""
        return self._send(requests.post, service_name, json, **kwargs)
1110904
private static String createTypeId(Type type) {
        if (type instanceof Class<?>)
            return Class.class.cast(type).getName();

        if (type instanceof ParameterizedType)
            return createTypeId(((ParameterizedType) type).getRawType())
                + Stream.of(((ParameterizedType) type).getActualTypeArguments())
                .map(CdiSpiHelper::createTypeId)
                .collect(joining(",", "<", ">"));

        if (type instanceof TypeVariable<?>)
            return TypeVariable.class.cast(type).getName();

        if (type instanceof GenericArrayType)
            return createTypeId(GenericArrayType.class.cast(type).getGenericComponentType());

        throw new UnsupportedOperationException("Unable to create type id for type [" + type + "]");
    }
1046403
@Override
    public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
        for (Class<?> t = type.getRawType(); (t != Object.class) && (t.getSuperclass() != null); t = t.getSuperclass()) {
            for (Method m : t.getDeclaredMethods()) {
                if (m.isAnnotationPresent(PostConstruct.class)) {
                    m.setAccessible(true);
                    TypeAdapter<T> delegate = gson.getDelegateAdapter(this, type);
                    return new PostConstructAdapter<T>(delegate, m);
                }
            }
        }
        return null;
    }
1332110
@NonNull
  public static CreateTypeStart createType(@NonNull String typeName) {
    return createType(CqlIdentifier.fromCql(typeName));
  }
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);
   }
454165
public static <T> Iterable<T> load(Class<T> serviceType) {
    try {
      BundleContext coreBundle = EhcacheActivator.getCoreBundle();
      return coreBundle.getServiceReferences(serviceType, null).stream().map(coreBundle::getService).collect(toList());
    } catch (InvalidSyntaxException e) {
      throw new AssertionError(e);
    }
  }