Search in sources :

Example 1 with ApiMetricCost

use of com.google.api.server.spi.config.ApiMetricCost in project endpoints-java by cloudendpoints.

the class ApiMethodAnnotationConfig method setMetricCosts.

public void setMetricCosts(ApiMetricCost[] metricCosts) {
    ImmutableList.Builder<ApiMetricCostConfig> costs = ImmutableList.builder();
    if (metricCosts != null && metricCosts.length > 0) {
        for (ApiMetricCost cost : metricCosts) {
            costs.add(ApiMetricCostConfig.builder().setName(cost.name()).setCost(cost.cost()).build());
        }
    }
    config.setMetricCosts(costs.build());
}
Also used : ApiMetricCostConfig(com.google.api.server.spi.config.model.ApiMetricCostConfig) ImmutableList(com.google.common.collect.ImmutableList) ApiMetricCost(com.google.api.server.spi.config.ApiMetricCost)

Aggregations

ApiMetricCost (com.google.api.server.spi.config.ApiMetricCost)1 ApiMetricCostConfig (com.google.api.server.spi.config.model.ApiMetricCostConfig)1 ImmutableList (com.google.common.collect.ImmutableList)1