Java Code Examples for io.micrometer.core.instrument.util.StringUtils#isBlank()

The following examples show how to use io.micrometer.core.instrument.util.StringUtils#isBlank() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SlackController.java    From mirrorgate with Apache License 2.0 6 votes vote down vote up
@RequestMapping(value = "/channels",
    method = GET,
    produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, String>> getDashboardChannels(
    final @RequestParam("dashboard") String dashboardId,
    final @RequestParam("token") String token
) {

    if (StringUtils.isBlank(token)) {
        return ResponseEntity.badRequest().build();
    }

    final DashboardDTO dashboard = dashboardService.getDashboard(dashboardId);

    if (dashboard == null) {
        return ResponseEntity.badRequest().build();
    }

    if (dashboard.getSlackToken() == null) {
        return ResponseEntity.status(HttpStatus.PRECONDITION_FAILED).build();
    }

    return ResponseEntity.ok(slackService.getChannelList(dashboard.getSlackToken()));
}
 
Example 2
Source File: ExecutorServiceMetrics.java    From micrometer with Apache License 2.0 5 votes vote down vote up
private static String sanitizePrefix(String metricPrefix) {
    if (StringUtils.isBlank(metricPrefix))
        return "";
    if (!metricPrefix.endsWith("."))
        return metricPrefix + ".";
    return metricPrefix;
}
 
Example 3
Source File: CloudWatchMeterRegistry.java    From micrometer with Apache License 2.0 5 votes vote down vote up
private boolean isAcceptableTag(Tag tag) {
    if (StringUtils.isBlank(tag.getValue())) {
        warnThenDebugLogger.log("Dropping a tag with key '" + tag.getKey() + "' because its value is blank.");
        return false;
    }
    return true;
}
 
Example 4
Source File: CloudWatchMeterRegistry.java    From micrometer with Apache License 2.0 5 votes vote down vote up
private boolean isAcceptableTag(Tag tag) {
    if (StringUtils.isBlank(tag.getValue())) {
        warnThenDebugLogger.log("Dropping a tag with key '" + tag.getKey() + "' because its value is blank.");
        return false;
    }
    return true;
}
 
Example 5
Source File: HttpSender.java    From micrometer with Apache License 2.0 4 votes vote down vote up
public Response(int code, @Nullable String body) {
    this.code = code;
    this.body = StringUtils.isBlank(body) ? NO_RESPONSE_BODY : body;
}