Java 类com.google.common.reflect.TypeToken 实例源码

项目:GitHub    文件:CallAdapterTest.java   
@Test public void rawTypes() throws NoSuchMethodException {
  assertThat(getRawType(String.class)).isSameAs(String.class);

  Type listOfString = new TypeToken<List<String>>() {}.getType();
  assertThat(getRawType(listOfString)).isSameAs(List.class);

  Type stringArray = new TypeToken<String[]>() {}.getType();
  assertThat(getRawType(stringArray)).isSameAs(String[].class);

  Type wild = ((ParameterizedType) new TypeToken<List<? extends CharSequence>>() {
  }.getType()).getActualTypeArguments()[0];
  assertThat(getRawType(wild)).isSameAs(CharSequence.class);

  Type wildParam = ((ParameterizedType) new TypeToken<List<? extends List<String>>>() {
  }.getType()).getActualTypeArguments()[0];
  assertThat(getRawType(wildParam)).isSameAs(List.class);

  Type typeVar = A.class.getDeclaredMethod("method").getGenericReturnType();
  assertThat(getRawType(typeVar)).isSameAs(Object.class);
}
项目:azure-libraries-for-java    文件:EndpointsInner.java   
/**
 * Deletes an existing CDN endpoint with the specified endpoint name under the specified subscription, resource group and profile.
 *
 * @param resourceGroupName Name of the Resource group within the Azure subscription.
 * @param profileName Name of the CDN profile which is unique within the resource group.
 * @param endpointName Name of the endpoint under the profile which is unique globally.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponse<Void>> deleteWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (profileName == null) {
        throw new IllegalArgumentException("Parameter profileName is required and cannot be null.");
    }
    if (endpointName == null) {
        throw new IllegalArgumentException("Parameter endpointName is required and cannot be null.");
    }
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    Observable<Response<ResponseBody>> observable = service.delete(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<Void>() { }.getType());
}
项目:beanmother    文件:OptionalTypeFixtureConverterTest.java   
@Test
public void testOptionalMapping() {
    Map<String, Object> map = new HashMap<>();
    map.put("simple", 1);
    map.put("optionalString", "testString");

    Map<String, String> beanMap = new HashMap<>();
    beanMap.put("name", "testName");
    map.put("optionalBean", beanMap);

    FixtureTemplate fixture = FixtureTemplateWrapper.wrap(map, null, null);

    OptionalTest result = (OptionalTest) converter.convert(fixture, TypeToken.of(OptionalTest.class));

    assertEquals(1, result.simple.get());
    assertEquals("testString", result.optionalString.get());
    assertEquals("testName", result.optionalBean.get().name.get());
}
项目:azure-libraries-for-java    文件:VirtualMachinesInner.java   
/**
 * Apply artifacts to virtual machine. This operation can take a while to complete.
 *
 * @param resourceGroupName The name of the resource group.
 * @param labName The name of the lab.
 * @param name The name of the virtual machine.
 * @param artifacts The list of artifacts to apply.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponse<Void>> applyArtifactsWithServiceResponseAsync(String resourceGroupName, String labName, String name, List<ArtifactInstallPropertiesInner> artifacts) {
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (labName == null) {
        throw new IllegalArgumentException("Parameter labName is required and cannot be null.");
    }
    if (name == null) {
        throw new IllegalArgumentException("Parameter name is required and cannot be null.");
    }
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    Validator.validate(artifacts);
    ApplyArtifactsRequest applyArtifactsRequest = new ApplyArtifactsRequest();
    applyArtifactsRequest.withArtifacts(artifacts);
    Observable<Response<ResponseBody>> observable = service.applyArtifacts(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), applyArtifactsRequest, this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<Void>() { }.getType());
}
项目:azure-libraries-for-java    文件:StreamingJobsInner.java   
/**
 * Starts a streaming job. Once a job is started it will start processing input events and produce output.
 *
 * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
 * @param jobName The name of the streaming job.
 * @param startJobParameters Parameters applicable to a start streaming job operation.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponse<Void>> startWithServiceResponseAsync(String resourceGroupName, String jobName, StartStreamingJobParametersInner startJobParameters) {
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (jobName == null) {
        throw new IllegalArgumentException("Parameter jobName is required and cannot be null.");
    }
    Validator.validate(startJobParameters);
    final String apiVersion = "2016-03-01";
    Observable<Response<ResponseBody>> observable = service.start(this.client.subscriptionId(), resourceGroupName, jobName, startJobParameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<Void>() { }.getType());
}
项目:azure-libraries-for-java    文件:ZonesInner.java   
/**
 * Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be undone.
 *
 * @param resourceGroupName The name of the resource group.
 * @param zoneName The name of the DNS zone (without a terminating dot).
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponse<ZoneDeleteResultInner>> deleteWithServiceResponseAsync(String resourceGroupName, String zoneName) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (zoneName == null) {
        throw new IllegalArgumentException("Parameter zoneName is required and cannot be null.");
    }
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    final String ifMatch = null;
    Observable<Response<ResponseBody>> observable = service.delete(resourceGroupName, zoneName, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<ZoneDeleteResultInner>() { }.getType());
}
项目:azure-libraries-for-java    文件:NamespacesInner.java   
/**
 * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent.
 *
 * @param resourceGroupName Name of the resource group within the azure subscription.
 * @param namespaceName The Namespace name
 * @param parameters Parameters for creating a namespace resource.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponse<NamespaceResourceInner>> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, NamespaceCreateOrUpdateParametersInner parameters) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (namespaceName == null) {
        throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null.");
    }
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    if (parameters == null) {
        throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
    }
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    Validator.validate(parameters);
    Observable<Response<ResponseBody>> observable = service.createOrUpdate(resourceGroupName, namespaceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<NamespaceResourceInner>() { }.getType());
}
项目:azure-libraries-for-java    文件:EndpointsInner.java   
/**
 * Starts an existing CDN endpoint that is on a stopped state.
 *
 * @param resourceGroupName Name of the Resource group within the Azure subscription.
 * @param profileName Name of the CDN profile which is unique within the resource group.
 * @param endpointName Name of the endpoint under the profile which is unique globally.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponse<EndpointInner>> startWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (profileName == null) {
        throw new IllegalArgumentException("Parameter profileName is required and cannot be null.");
    }
    if (endpointName == null) {
        throw new IllegalArgumentException("Parameter endpointName is required and cannot be null.");
    }
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    Observable<Response<ResponseBody>> observable = service.start(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<EndpointInner>() { }.getType());
}
项目:azure-libraries-for-java    文件:VirtualNetworkGatewaysInner.java   
/**
 * Resets the primary of the virtual network gateway in the specified resource group.
 *
 * @param resourceGroupName The name of the resource group.
 * @param virtualNetworkGatewayName The name of the virtual network gateway.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponse<VirtualNetworkGatewayInner>> resetWithServiceResponseAsync(String resourceGroupName, String virtualNetworkGatewayName) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (virtualNetworkGatewayName == null) {
        throw new IllegalArgumentException("Parameter virtualNetworkGatewayName is required and cannot be null.");
    }
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    final String apiVersion = "2017-08-01";
    final String gatewayVip = null;
    Observable<Response<ResponseBody>> observable = service.reset(resourceGroupName, virtualNetworkGatewayName, this.client.subscriptionId(), gatewayVip, apiVersion, this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<VirtualNetworkGatewayInner>() { }.getType());
}
项目:azure-libraries-for-java    文件:NetworkWatchersInner.java   
/**
 * Queries status of flow log on a specified resource.
 *
 * @param resourceGroupName The name of the network watcher resource group.
 * @param networkWatcherName The name of the network watcher resource.
 * @param targetResourceId The target resource where getting the flow logging status.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponse<FlowLogInformationInner>> getFlowLogStatusWithServiceResponseAsync(String resourceGroupName, String networkWatcherName, String targetResourceId) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (networkWatcherName == null) {
        throw new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null.");
    }
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    if (targetResourceId == null) {
        throw new IllegalArgumentException("Parameter targetResourceId is required and cannot be null.");
    }
    final String apiVersion = "2017-08-01";
    FlowLogStatusParameters parameters = new FlowLogStatusParameters();
    parameters.withTargetResourceId(targetResourceId);
    Observable<Response<ResponseBody>> observable = service.getFlowLogStatus(resourceGroupName, networkWatcherName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<FlowLogInformationInner>() { }.getType());
}
项目:azure-libraries-for-java    文件:EnvironmentsInner.java   
/**
 * Create or replace an existing environment. This operation can take a while to complete.
 *
 * @param resourceGroupName The name of the resource group.
 * @param labName The name of the lab.
 * @param userName The name of the user profile.
 * @param name The name of the environment.
 * @param dtlEnvironment An environment, which is essentially an ARM template deployment.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponse<DtlEnvironmentInner>> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String labName, String userName, String name, DtlEnvironmentInner dtlEnvironment) {
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (labName == null) {
        throw new IllegalArgumentException("Parameter labName is required and cannot be null.");
    }
    if (userName == null) {
        throw new IllegalArgumentException("Parameter userName is required and cannot be null.");
    }
    if (name == null) {
        throw new IllegalArgumentException("Parameter name is required and cannot be null.");
    }
    if (dtlEnvironment == null) {
        throw new IllegalArgumentException("Parameter dtlEnvironment is required and cannot be null.");
    }
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    Validator.validate(dtlEnvironment);
    Observable<Response<ResponseBody>> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, labName, userName, name, dtlEnvironment, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<DtlEnvironmentInner>() { }.getType());
}
项目:azure-libraries-for-java    文件:BatchAccountsInner.java   
private ServiceResponseWithHeaders<BatchAccountInner, BatchAccountCreateHeadersInner> beginCreateDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
    return this.client.restClient().responseBuilderFactory().<BatchAccountInner, CloudException>newInstance(this.client.serializerAdapter())
            .register(200, new TypeToken<BatchAccountInner>() { }.getType())
            .register(202, new TypeToken<Void>() { }.getType())
            .registerError(CloudException.class)
            .buildWithHeaders(response, BatchAccountCreateHeadersInner.class);
}
项目:azure-libraries-for-java    文件:DatabasesInner.java   
private ServiceResponse<Void> beginPauseDataWarehouseDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
    return this.client.restClient().responseBuilderFactory().<Void, CloudException>newInstance(this.client.serializerAdapter())
            .register(200, new TypeToken<Void>() { }.getType())
            .register(202, new TypeToken<Void>() { }.getType())
            .registerError(CloudException.class)
            .build(response);
}
项目:Neutrino    文件:TypeSerialiserTests.java   
@Test
public void testThatIntArraysCanBeSerialised() throws ObjectMappingException {
    int[] array = { 4, -2 };

    TestConfigurationLoader tcl = getArrayTestLoader();
    ConfigurationNode cn = tcl.createEmptyNode().setValue(new TypeToken<int[]>() {}, array);

    List<Integer> ls = cn.getList(TypeToken.of(Integer.class));
    Assert.assertTrue(ls.contains(4));
    Assert.assertTrue(ls.contains(-2));
}
项目:azure-libraries-for-java    文件:WebAppsInner.java   
private ServiceResponse<VnetGatewayInner> getVnetConnectionGatewayDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
    return this.client.restClient().responseBuilderFactory().<VnetGatewayInner, CloudException>newInstance(this.client.serializerAdapter())
            .register(200, new TypeToken<VnetGatewayInner>() { }.getType())
            .register(404, new TypeToken<Void>() { }.getType())
            .registerError(CloudException.class)
            .build(response);
}
项目:azure-libraries-for-java    文件:FormulasInner.java   
private ServiceResponse<FormulaInner> beginCreateOrUpdateDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
    return this.client.restClient().responseBuilderFactory().<FormulaInner, CloudException>newInstance(this.client.serializerAdapter())
            .register(200, new TypeToken<FormulaInner>() { }.getType())
            .register(201, new TypeToken<FormulaInner>() { }.getType())
            .registerError(CloudException.class)
            .build(response);
}
项目:azure-libraries-for-java    文件:ManagementLocksInner.java   
private ServiceResponse<Void> deleteAtSubscriptionLevelDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
    return this.client.restClient().responseBuilderFactory().<Void, CloudException>newInstance(this.client.serializerAdapter())
            .register(204, new TypeToken<Void>() { }.getType())
            .register(200, new TypeToken<Void>() { }.getType())
            .registerError(CloudException.class)
            .build(response);
}
项目:azure-libraries-for-java    文件:VirtualMachineScaleSetVMsInner.java   
private ServiceResponse<OperationStatusResponseInner> beginPowerOffDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
    return this.client.restClient().responseBuilderFactory().<OperationStatusResponseInner, CloudException>newInstance(this.client.serializerAdapter())
            .register(200, new TypeToken<OperationStatusResponseInner>() { }.getType())
            .register(202, new TypeToken<Void>() { }.getType())
            .registerError(CloudException.class)
            .build(response);
}
项目:GitHub    文件:ExecutorCallAdapterFactoryTest.java   
@Test public void responseType() {
  Type classType = new TypeToken<Call<String>>() {}.getType();
  assertThat(factory.get(classType, NO_ANNOTATIONS, retrofit).responseType())
      .isEqualTo(String.class);
  Type wilcardType = new TypeToken<Call<? extends String>>() {}.getType();
  assertThat(factory.get(wilcardType, NO_ANNOTATIONS, retrofit).responseType())
      .isEqualTo(String.class);
  Type genericType = new TypeToken<Call<List<String>>>() {}.getType();
  assertThat(factory.get(genericType, NO_ANNOTATIONS, retrofit).responseType())
      .isEqualTo(new TypeToken<List<String>>() {}.getType());
}
项目:azure-libraries-for-java    文件:SessionsInner.java   
private ServiceResponse<Void> deleteDelegate(Response<ResponseBody> response) throws ErrorResponseException, IOException, IllegalArgumentException {
    return this.client.restClient().responseBuilderFactory().<Void, ErrorResponseException>newInstance(this.client.serializerAdapter())
            .register(200, new TypeToken<Void>() { }.getType())
            .register(204, new TypeToken<Void>() { }.getType())
            .registerError(ErrorResponseException.class)
            .build(response);
}
项目:azure-libraries-for-java    文件:WebAppsInner.java   
private ServiceResponse<MSDeployLogInner> getMSDeployLogDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
    return this.client.restClient().responseBuilderFactory().<MSDeployLogInner, CloudException>newInstance(this.client.serializerAdapter())
            .register(200, new TypeToken<MSDeployLogInner>() { }.getType())
            .register(404, new TypeToken<Void>() { }.getType())
            .registerError(CloudException.class)
            .build(response);
}
项目:daf-cacher    文件:IntegrationTestDataProvider.java   
public IntegrationTestDataProvider() {
    this.list = new ArrayList<>();

    ClassLoader classLoader = getClass().getClassLoader();
    try {
        String result = IOUtils.toString(classLoader.getResourceAsStream("integration-data.json"), "UTF-8");
        this.list = new GsonBuilder().create().fromJson(result, new TypeToken<List<EmbeddableData>>() {
        }.getType());
    } catch (IOException e) {
        /* ignored */
    }
}
项目:Neutrino    文件:TypeSerialiserTests.java   
@Test
public void testThatIntArraysCanBeDeserialised() throws ObjectMappingException {
    TestConfigurationLoader tcl = getArrayTestLoader();
    ConfigurationNode cn = tcl.createEmptyNode().setValue(new TypeToken<List<Integer>>() {}, Lists.newArrayList(4, -2));

    int[] ls = cn.getValue(new TypeToken<int[]>() {});
    Assert.assertEquals(2, ls.length);

    Assert.assertTrue(ls[0] == 4);
    Assert.assertTrue(ls[1] == -2);
}
项目:azure-libraries-for-java    文件:WebAppsInner.java   
private ServiceResponse<MSDeployLogInner> getMSDeployLogSlotDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
    return this.client.restClient().responseBuilderFactory().<MSDeployLogInner, CloudException>newInstance(this.client.serializerAdapter())
            .register(200, new TypeToken<MSDeployLogInner>() { }.getType())
            .register(404, new TypeToken<Void>() { }.getType())
            .registerError(CloudException.class)
            .build(response);
}
项目:azure-libraries-for-java    文件:WebAppsInner.java   
private ServiceResponse<Void> runTriggeredWebJobSlotDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
    return this.client.restClient().responseBuilderFactory().<Void, CloudException>newInstance(this.client.serializerAdapter())
            .register(200, new TypeToken<Void>() { }.getType())
            .register(404, new TypeToken<Void>() { }.getType())
            .registerError(CloudException.class)
            .build(response);
}
项目:azure-libraries-for-java    文件:ApplicationGatewaysInner.java   
/**
 * Deletes the specified application gateway.
 *
 * @param resourceGroupName The name of the resource group.
 * @param applicationGatewayName The name of the application gateway.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponse<Void>> deleteWithServiceResponseAsync(String resourceGroupName, String applicationGatewayName) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (applicationGatewayName == null) {
        throw new IllegalArgumentException("Parameter applicationGatewayName is required and cannot be null.");
    }
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    final String apiVersion = "2017-08-01";
    Observable<Response<ResponseBody>> observable = service.delete(resourceGroupName, applicationGatewayName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<Void>() { }.getType());
}
项目:beanmother    文件:GuavaOptionalConverterModuleTest.java   
@Test
public void testNumberToOptionalOfLongConverter() {
    converter = new GuavaOptionalConverterModule.NumberToOptionalOfLongConverter();

    assertTrue(converter.canHandle(1L, new TypeToken<Optional<Long>>() {}));

    Object result = converter.convert(1L, new TypeToken<Optional<Long>>() {});
    assertTrue(result instanceof Optional);
    assertEquals(Long.valueOf(1), ((Optional<Long>) result).get());
}
项目:azure-libraries-for-java    文件:WebAppsInner.java   
private ServiceResponse<ProcessModuleInfoInner> getProcessModuleSlotDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
    return this.client.restClient().responseBuilderFactory().<ProcessModuleInfoInner, CloudException>newInstance(this.client.serializerAdapter())
            .register(200, new TypeToken<ProcessModuleInfoInner>() { }.getType())
            .register(404, new TypeToken<Void>() { }.getType())
            .registerError(CloudException.class)
            .build(response);
}
项目:googles-monorepo-demo    文件:FreshValueGeneratorTest.java   
@AndroidIncompatible // problem with equality of Type objects?
public void testOptional() {
  FreshValueGenerator generator = new FreshValueGenerator();
  assertEquals(Optional.absent(), generator.generateFresh(new TypeToken<Optional<String>>() {}));
  assertEquals(Optional.of("2"), generator.generateFresh(new TypeToken<Optional<String>>() {}));
  // Test that the first generated instance for different Optional<T> is always absent().
  // Having generated Optional<String> instances doesn't prevent absent() from being generated for
  // other Optional types.
  assertEquals(Optional.absent(),
      generator.generateFresh(new TypeToken<Optional<OneConstantEnum>>() {}));
  assertEquals(Optional.of(OneConstantEnum.CONSTANT1),
      generator.generateFresh(new TypeToken<Optional<OneConstantEnum>>() {}));
}
项目:beanmother    文件:JavaOptionalConverterModule.java   
@Override
public Object convert(Object source, TypeToken<?> targetTypeToken) {
    Object converted = stringToNumberConverter.convert(source, TypeToken.of(Long.class));

    if (converted == null) {
        return OptionalLong.empty();
    } else {
        return OptionalLong.of((Long) converted);
    }
}
项目:batch-scheduler    文件:ArgumentController.java   
@RequestMapping(method = RequestMethod.POST, value = "/delete")
@ResponseBody
public String deleteArgumentDefine(HttpServletResponse response, HttpServletRequest request) {
    String json = request.getParameter("JSON");
    List<ArgumentDefineEntity> list = new GsonBuilder().create().fromJson(json, new TypeToken<List<ArgumentDefineEntity>>() {
    }.getType());
    RetMsg msg = argumentService.deleteArgument(list);
    if (SysStatus.SUCCESS_CODE == msg.getCode()) {
        return Hret.success(msg);
    }
    response.setStatus(421);
    return Hret.error(msg);
}
项目:Reer    文件:AbstractAnnotationDrivenModelRuleExtractor.java   
protected AbstractAnnotationDrivenModelRuleExtractor() {
    @SuppressWarnings("unchecked") Class<T> annotationType = (Class<T>) new TypeToken<T>(getClass()) {}.getRawType();
    this.annotationType = annotationType;
}
项目:autorest.java    文件:ExplicitsImpl.java   
private ServiceResponse<Void> postOptionalArrayPropertyDelegate(Response<ResponseBody> response) throws ErrorException, IOException {
    return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter())
            .register(200, new TypeToken<Void>() { }.getType())
            .registerError(ErrorException.class)
            .build(response);
}
项目:azure-libraries-for-java    文件:NetworkWatchersInner.java   
private ServiceResponse<TopologyInner> getTopologyDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
    return this.client.restClient().responseBuilderFactory().<TopologyInner, CloudException>newInstance(this.client.serializerAdapter())
            .register(200, new TypeToken<TopologyInner>() { }.getType())
            .registerError(CloudException.class)
            .build(response);
}
项目:CustomWorldGen    文件:JsonUtils.java   
@SuppressWarnings({ "serial", "unchecked" })
private static <E> TypeToken<Map<String, E>> mapOf(final Type arg)
{
    return new TypeToken<Map<String, E>>() {}.where(new TypeParameter<E>() {}, (TypeToken<E>) TypeToken.of(arg));
}
项目:autorest.java    文件:LROsCustomHeadersImpl.java   
private ServiceResponseWithHeaders<Void, LROsCustomHeaderPost202Retry200Headers> beginPost202Retry200Delegate(Response<ResponseBody> response) throws CloudException, IOException {
    return this.client.restClient().responseBuilderFactory().<Void, CloudException>newInstance(this.client.serializerAdapter())
            .register(202, new TypeToken<Void>() { }.getType())
            .registerError(CloudException.class)
            .buildWithHeaders(response, LROsCustomHeaderPost202Retry200Headers.class);
}
项目:autorest.java    文件:BasicsImpl.java   
private ServiceResponse<Basic> getInvalidDelegate(Response<ResponseBody> response) throws ErrorException, IOException {
    return this.client.restClient().responseBuilderFactory().<Basic, ErrorException>newInstance(this.client.serializerAdapter())
            .register(200, new TypeToken<Basic>() { }.getType())
            .registerError(ErrorException.class)
            .build(response);
}
项目:googles-monorepo-demo    文件:FreshValueGenerator.java   
@Nullable final <T> T generateFresh(Class<T> type) {
  return Primitives.wrap(type).cast(generateFresh(TypeToken.of(type)));
}
项目:autorest.java    文件:EnumsImpl.java   
private ServiceResponse<Colors> getNotExpandableDelegate(Response<ResponseBody> response) throws ErrorException, IOException {
    return this.client.restClient().responseBuilderFactory().<Colors, ErrorException>newInstance(this.client.serializerAdapter())
            .register(200, new TypeToken<Colors>() { }.getType())
            .registerError(ErrorException.class)
            .build(response);
}
项目:azure-libraries-for-java    文件:RecommendationsInner.java   
private ServiceResponse<List<RecommendationInner>> listHistoryForWebAppDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
    return this.client.restClient().responseBuilderFactory().<List<RecommendationInner>, CloudException>newInstance(this.client.serializerAdapter())
            .register(200, new TypeToken<List<RecommendationInner>>() { }.getType())
            .registerError(CloudException.class)
            .build(response);
}