当前位置: 首页>>代码示例>>Java>>正文


Java Strings.isBlank方法代码示例

本文整理汇总了Java中org.apache.logging.log4j.util.Strings.isBlank方法的典型用法代码示例。如果您正苦于以下问题:Java Strings.isBlank方法的具体用法?Java Strings.isBlank怎么用?Java Strings.isBlank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.logging.log4j.util.Strings的用法示例。


在下文中一共展示了Strings.isBlank方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: exec

import org.apache.logging.log4j.util.Strings; //导入方法依赖的package包/类
@Override
public void exec(Plugin plugin) {
    LOGGER.traceMarker("PushProcessor", "Push tags to local");

    if (!Strings.isBlank(plugin.getPluginDetail().getImage()) && !Strings
        .isBlank(plugin.getPluginDetail().getBuild())) {
        return;
    }

    try {
        // put from cache to local git workspace
        Path cachePath = gitCachePath(plugin);
        String latestGitTag = plugin.getTag();
        JGitUtil.push(cachePath, LOCAL_REMOTE, latestGitTag);
        // set currentTag latestTag
        plugin.setCurrentTag(latestGitTag);
        updatePluginStatus(plugin, INSTALLED);
    } catch (GitException e) {
        LOGGER.error("Git Push", e);
        throw new PluginException("Git Push", e);
    }
}
 
开发者ID:FlowCI,项目名称:flow-platform,代码行数:23,代码来源:PluginServiceImpl.java

示例2: apply

import org.apache.logging.log4j.util.Strings; //导入方法依赖的package包/类
@Override
public void apply(final SendMessage sendMessage) {
	final ImageSendPayload imageSendPayload = sendMessage.getPayloadWithType(ImageSendPayload.class);

	final String title = imageSendPayload.getTitle();
	final String imageUrl = imageSendPayload.getImageUrl();
	final String recipient = sendMessage.getRecipient().getId();

	final SendPhoto sendPhotoTelegram = new SendPhoto(recipient, imageUrl);

	if (!Strings.isBlank(title)) {
		sendPhotoTelegram.caption(title);
	}

	LOG.info("sending image {} to recipient {}", sendPhotoTelegram, recipient);
	final TelegramBot client = provideTelegramBot(sendMessage);
	client.execute(sendPhotoTelegram);
}
 
开发者ID:nitroventures,项目名称:bot4j,代码行数:19,代码来源:ImageRuleImpl.java

示例3: sendButtonElement

import org.apache.logging.log4j.util.Strings; //导入方法依赖的package包/类
protected void sendButtonElement(final SendMessage sendMessage, final String recipient,
		final ListSendElement listSendElement) {
	final AbstractSendButton abstractButton = listSendElement.getButton();
	final List<InlineKeyboardButton> buttonList = new ArrayList<InlineKeyboardButton>();

	buttonList.add(telegramSendInlineKeyboardFactory.createInlineKeyboard(abstractButton));
	InlineKeyboardButton[] inlineKeyboardButtons = new InlineKeyboardButton[buttonList.size()];
	inlineKeyboardButtons = buttonList.toArray(inlineKeyboardButtons);
	final InlineKeyboardMarkup inlineKeyboardMarkup = new InlineKeyboardMarkup(inlineKeyboardButtons);

	String title = listSendElement.getTitle();

	if (Strings.isBlank(title)) {
		title = "undefined title of buttonSendPayload";
	}

	final String boldTitle = "*" + title + "*";
	final com.pengrad.telegrambot.request.SendMessage sendMessageTelegram = new com.pengrad.telegrambot.request.SendMessage(
			recipient, boldTitle).replyMarkup(inlineKeyboardMarkup).parseMode(ParseMode.Markdown);
	super.execute(sendMessage, sendMessageTelegram, recipient);
}
 
开发者ID:nitroventures,项目名称:bot4j,代码行数:22,代码来源:ListRuleImpl.java

示例4: apply

import org.apache.logging.log4j.util.Strings; //导入方法依赖的package包/类
@Override
public void apply(final SendMessage sendMessage) {
	final VideoSendPayload videoSendPayload = sendMessage.getPayloadWithType(VideoSendPayload.class);

	final String title = videoSendPayload.getTitle();
	final String videoUrl = videoSendPayload.getVideoUrl();
	final String recipient = sendMessage.getRecipient().getId();

	final SendVideo sendVideoTelegram = new SendVideo(recipient, videoUrl);

	if (!Strings.isBlank(title)) {
		sendVideoTelegram.caption(title);
	}

	LOG.info("sending video {} to recipient {}", sendVideoTelegram, recipient);
	final TelegramBot client = provideTelegramBot(sendMessage);
	client.execute(sendVideoTelegram);
}
 
开发者ID:nitroventures,项目名称:bot4j,代码行数:19,代码来源:VideoRuleImpl.java

示例5: apply

import org.apache.logging.log4j.util.Strings; //导入方法依赖的package包/类
@Override
public void apply(final SendMessage sendMessage) {
	final ButtonsSendPayload buttonsSendPayload = sendMessage.getPayloadWithType(ButtonsSendPayload.class);
	final List<InlineKeyboardButton> buttonList = new ArrayList<InlineKeyboardButton>();

	for (final AbstractSendButton button : buttonsSendPayload.getButtons()) {
		buttonList.add(telegramSendInlineKeyboardFactory.createInlineKeyboard(button));
	}

	InlineKeyboardButton[] inlineKeyboardButtons = new InlineKeyboardButton[buttonList.size()];
	inlineKeyboardButtons = buttonList.toArray(inlineKeyboardButtons);
	final InlineKeyboardMarkup inlineKeyboardMarkup = new InlineKeyboardMarkup(inlineKeyboardButtons);

	String title = buttonsSendPayload.getTitle();

	if (Strings.isBlank(title)) {
		title = "undefined title of buttonSendPayload";
	}

	final String boldTitle = "*" + title + "*";
	final String recipient = sendMessage.getRecipient().getId();

	final com.pengrad.telegrambot.request.SendMessage sendMessageTelegram = new com.pengrad.telegrambot.request.SendMessage(
			recipient, boldTitle).replyMarkup(inlineKeyboardMarkup).parseMode(ParseMode.Markdown);
	super.execute(sendMessage, sendMessageTelegram, recipient);
}
 
开发者ID:nitroventures,项目名称:bot4j,代码行数:27,代码来源:ButtonsRuleImpl.java

示例6: getRecentHostEntries

import org.apache.logging.log4j.util.Strings; //导入方法依赖的package包/类
/**
 * Gets the recent host entries.
 *
 * @param maxNumItems
 *            the max num items
 * @return the recent host entries
 */
public Collection<HostEntry> getRecentHostEntries(int maxNumItems) {
	synchronized (this) {
		Collection<HostEntry> items = new LinkedList<HostEntry>();
		Iterator<TimedEntry> i = this.historyTimedSet.iterator();
		Set<String> hosts = new HashSet<String>();
		while (i.hasNext()) {
			TimedEntry entry = i.next();
			String host = entry.url.getHost();
			if (Strings.isBlank(host) && !hosts.contains(host)) {

				hosts.add(host);
				if (hosts.size() >= maxNumItems) {
					break;
				}
			
				items.add(new HostEntry(host, entry.timestamp));
			}
		}
		return items;
	}
}
 
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:29,代码来源:BaseHistory.java

示例7: doCompareParseTree

import org.apache.logging.log4j.util.Strings; //导入方法依赖的package包/类
protected void doCompareParseTree(final File treeFile, final StartRuleContext startRule,
		final VisualBasic6Parser parser) throws IOException {

	final String treeFileData = FileUtils.readFileToString(treeFile);

	if (!Strings.isBlank(treeFileData)) {
		LOG.info("Comparing parse tree with file {}.", treeFile.getName());

		final String inputFileTree = Trees.toStringTree(startRule, parser);
		final String cleanedInputFileTree = io.proleap.vb6.util.StringUtils.cleanFileTree(inputFileTree);
		final String cleanedTreeFileData = io.proleap.vb6.util.StringUtils.cleanFileTree(treeFileData);

		assertEquals(cleanedTreeFileData, cleanedInputFileTree);
	} else {
		LOG.info("Ignoring empty parse tree file {}.", treeFile.getName());
	}
}
 
开发者ID:uwol,项目名称:vb6parser,代码行数:18,代码来源:VbParseTestRunnerImpl.java

示例8: initialize

import org.apache.logging.log4j.util.Strings; //导入方法依赖的package包/类
/**
 * Initializes the Logging Context.
 * @param name The Context name.
 * @param loader The ClassLoader for the Context (or null).
 * @param configLocation The configuration for the logging context (or null, or blank).
 * @param externalContext The external context to be attached to the LoggerContext
 * @return The LoggerContext or null if an error occurred (check the status logger).
 */
public static LoggerContext initialize(final String name, final ClassLoader loader, final String configLocation,
        final Object externalContext) {
    if (Strings.isBlank(configLocation)) {
        return initialize(name, loader, (URI) null, externalContext);
    }
    if (configLocation.contains(",")) {
        final String[] parts = configLocation.split(",");
        String scheme = null;
        final List<URI> uris = new ArrayList<>(parts.length);
        for (final String part : parts) {
            final URI uri = NetUtils.toURI(scheme != null ? scheme + ":" + part.trim() : part.trim());
            if (scheme == null && uri.getScheme() != null) {
                scheme = uri.getScheme();
            }
            uris.add(uri);
        }
        return initialize(name, loader, uris, externalContext);
    }
    return initialize(name, loader, NetUtils.toURI(configLocation), externalContext);
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:29,代码来源:Configurator.java

示例9: init

import org.apache.logging.log4j.util.Strings; //导入方法依赖的package包/类
@Inject
protected void init() {
	final String webhookUrl = telegramConfigService.getWebhookUrl((ReceiveMessage) null);

	if (Strings.isBlank(webhookUrl)) {
	} else {
		final SetWebhook request = new SetWebhook().url(webhookUrl);
		final TelegramBot bot = provideTelegramBot();
		bot.execute(request);
	}
}
 
开发者ID:nitroventures,项目名称:bot4j,代码行数:12,代码来源:TelegramWebhookImpl.java

示例10: handleMessage

import org.apache.logging.log4j.util.Strings; //导入方法依赖的package包/类
protected void handleMessage(final Message message, final ReceiveMessage result) {
	final String messageId = String.valueOf(message.messageId());
	result.setMessageId(messageId);

	if (message.audio() != null) {
		handleAudio(message.audio(), result);
	}

	if (message.document() != null) {
		handleDocument(message, result);
	}

	if (message.location() != null) {
		handleLocation(message.location(), result);
	}

	if (message.photo() != null) {
		handlePhoto(message, result);
	}

	if (message.sticker() != null) {
		handleSticker(message.sticker(), result);
	}

	if (!Strings.isBlank(message.text())) {
		if ("/start".equals(message.text())) {
			handleStartMessage(message.text(), result);
		} else {
			handleText(message.text(), result);
		}
	}

	if (message.video() != null) {
		handleVideo(message, result);
	}

	if (message.voice() != null) {
		handleVoice(message.voice(), result);
	}
}
 
开发者ID:nitroventures,项目名称:bot4j,代码行数:41,代码来源:TelegramReceiveMessageFactoryImpl.java

示例11: sendPhotoElement

import org.apache.logging.log4j.util.Strings; //导入方法依赖的package包/类
protected void sendPhotoElement(final SendMessage sendMessage, final String recipient,
		final ListSendElement listSendElement) {
	final SendPhoto sendPhotoTelegram = new SendPhoto(recipient, listSendElement.getImageUrl());
	final String title = listSendElement.getTitle();

	if (!Strings.isBlank(title)) {
		sendPhotoTelegram.caption(title);
	}

	LOG.info("sending image {} to recipient {}", sendPhotoTelegram, recipient);
	final TelegramBot client = provideTelegramBot(sendMessage);
	client.execute(sendPhotoTelegram);
}
 
开发者ID:nitroventures,项目名称:bot4j,代码行数:14,代码来源:ListRuleImpl.java

示例12: createTitle

import org.apache.logging.log4j.util.Strings; //导入方法依赖的package包/类
protected String createTitle(final Bubble bubble) {
	String title = bubble.getTitle();
	final String text = bubble.getText();

	if (Strings.isBlank(title) && Strings.isBlank(text)) {
		title = "undefined title of bubble";
	}

	final String boldTitle = "*" + title + "*";

	final StringBuilder stringBuilder = new StringBuilder();
	final String result = stringBuilder.append(StringUtils.defaultString(boldTitle)).append(" ")
			.append(StringUtils.defaultString(text)).toString();
	return result;
}
 
开发者ID:nitroventures,项目名称:bot4j,代码行数:16,代码来源:BubbleRuleImpl.java

示例13: get

import org.apache.logging.log4j.util.Strings; //导入方法依赖的package包/类
@Override
public String get(final HttpServletRequest req, final HttpServletResponse res) {
	String result = "";

	try {
		final String clientId = slackConfigService.getClientId((ReceiveMessage) null);
		final String clientSecret = slackConfigService.getClientSecret((ReceiveMessage) null);
		final String code = req.getParameter("code");

		if (Strings.isBlank(clientId)) {
			LOG.warn("client_id is not set in slack.properties");
			result = "client_id is not set in slack.properties";
		} else if (Strings.isBlank(clientSecret)) {
			LOG.warn("client_secret is not set in slack.properties");
			result = "client_secret is not set in slack.properties";
		} else if (Strings.isBlank(code)) {
			LOG.warn("query parameter code is missing");
			result = "query parameter code is missing";
		} else {
			final String accessToken = slackOAuthClient.getBotAccessToken(code, clientId, clientSecret);

			LOG.info("OAuth access token is {}", accessToken);
			result = "add line to slack.properties: access_token = " + accessToken;
		}
	} catch (final Exception e) {
		handleException(e);
	}

	return result;
}
 
开发者ID:nitroventures,项目名称:bot4j,代码行数:31,代码来源:SlackOAuthWebhookImpl.java

示例14: handleMessagingItem

import org.apache.logging.log4j.util.Strings; //导入方法依赖的package包/类
protected void handleMessagingItem(final MessagingItem messagingItem, final Map<String, String[]> params) {
	final MessagingParticipant sender = messagingItem.getSender();

	if (sender == null || Strings.isBlank(sender.getId())) {
		LOG.warn("Ignoring message with empty sender");
	} else {
		facebookMessageHandler.handleMessagingItem(messagingItem, params);
	}
}
 
开发者ID:nitroventures,项目名称:bot4j,代码行数:10,代码来源:FacebookWebhookImpl.java

示例15: handleMessageItem

import org.apache.logging.log4j.util.Strings; //导入方法依赖的package包/类
protected void handleMessageItem(final MessageItem messageItem, final ReceiveMessage result) {
	result.setMessageId(messageItem.getMid());

	if (!Strings.isBlank(messageItem.getText())) {
		handleText(messageItem.getText(), result);
	}

	if (messageItem.getQuickReply() != null) {
		handleQuickReplyItem(messageItem.getQuickReply(), result);
	}

	for (final MessagingAttachment messagingAttachment : messageItem.getAttachments()) {
		handleMessagingAttachment(result, messagingAttachment);
	}
}
 
开发者ID:nitroventures,项目名称:bot4j,代码行数:16,代码来源:FacebookReceiveMessageFactoryImpl.java


注:本文中的org.apache.logging.log4j.util.Strings.isBlank方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。