本文整理汇总了Java中com.stackify.api.common.util.Preconditions.checkArgument方法的典型用法代码示例。如果您正苦于以下问题:Java Preconditions.checkArgument方法的具体用法?Java Preconditions.checkArgument怎么用?Java Preconditions.checkArgument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.stackify.api.common.util.Preconditions
的用法示例。
在下文中一共展示了Preconditions.checkArgument方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MetricIdentity
import com.stackify.api.common.util.Preconditions; //导入方法依赖的package包/类
/**
* Constructor
* @param category Metric category
* @param name Metric name
* @param type Metric monitor type
*/
public MetricIdentity(final String category, final String name, final MetricMonitorType type) {
Preconditions.checkNotNull(category);
Preconditions.checkArgument(!category.isEmpty());
Preconditions.checkNotNull(name);
Preconditions.checkArgument(!name.isEmpty());
Preconditions.checkNotNull(type);
this.category = category;
this.name = name;
this.type = type;
}
示例2: MetricAggregator
import com.stackify.api.common.util.Preconditions; //导入方法依赖的package包/类
/**
* Constructor
* @param currentMinute Current minute
* @param lastValues Last values for the metrics
*/
public MetricAggregator(final long currentMinute, final Map<MetricIdentity, Double> lastValues) {
Preconditions.checkArgument(0 < currentMinute);
Preconditions.checkNotNull(lastValues);
this.currentMinute = currentMinute;
this.lastValues = lastValues;
}
示例3: SynchronizedEvictingQueue
import com.stackify.api.common.util.Preconditions; //导入方法依赖的package包/类
/**
* Constructor
* @param maxSize Maximum size of the queue
*/
public SynchronizedEvictingQueue(final int maxSize) {
Preconditions.checkArgument(0 < maxSize);
this.maxSize = maxSize;
this.deque = new ArrayDeque<E>(maxSize);
}
示例4: activate
import com.stackify.api.common.util.Preconditions; //导入方法依赖的package包/类
/**
* Activates the appender
* @param apiConfig API configuration
*/
public void activate(final ApiConfiguration apiConfig) {
Preconditions.checkNotNull(apiConfig);
Preconditions.checkNotNull(apiConfig.getApiUrl());
Preconditions.checkArgument(!apiConfig.getApiUrl().isEmpty());
Preconditions.checkNotNull(apiConfig.getApiKey());
Preconditions.checkArgument(!apiConfig.getApiKey().isEmpty());
// Single JSON object mapper for all services
ObjectMapper objectMapper = new ObjectMapper();
// build the app identity service
AppIdentityService appIdentityService = new AppIdentityService(apiConfig, objectMapper);
// build the services for collecting and sending log messages
this.collector = new LogCollector(logger, apiConfig.getEnvDetail(), appIdentityService);
LogSender sender = new LogSender(apiConfig, objectMapper, this.masker, this.skipJson);
// set allowComDotStackify
if (Boolean.TRUE.equals(apiConfig.getAllowComDotStackify())) {
this.allowComDotStackify = true;
}
// build the background service to asynchronously post errors to Stackify
// startup the background service
this.backgroundService = new LogBackgroundService(collector, sender);
this.backgroundService.start();
}