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


Java Strings类代码示例

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


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

示例1: ElasticBulkSender

import org.apache.logging.log4j.util.Strings; //导入依赖的package包/类
public ElasticBulkSender(String user, String password, HttpHost... hosts) {
	this.user = user;
	this.password = password;
	this.hosts = hosts;
	this.restClient = RestClient.builder(hosts)
			.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
				@Override
				public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
					if (!Strings.isBlank(user)) {
						CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
						credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(user, password));
		                return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
					} else {
						return httpClientBuilder;
					}
				}
	        })
			.build();
}
 
开发者ID:magrossi,项目名称:es-log4j2-appender,代码行数:20,代码来源:ElasticBulkSender.java

示例2: startRequestSender

import org.apache.logging.log4j.util.Strings; //导入依赖的package包/类
public void startRequestSender(final String index, final long filePosition, final ActionListener<Map<String, Object>> listener) {
    if (!senderNodes.isEmpty() && !senderNodes.contains(nodeName())) {
        listener.onFailure(new ElasticsearchException(nodeName() + " is not a Sender node."));
        return;
    }

    if (logger.isDebugEnabled()) {
        logger.debug("Starting RequestSender(" + index + ")");
    }
    client.prepareGet(IndexingProxyPlugin.INDEX_NAME, IndexingProxyPlugin.TYPE_NAME, index).setRefresh(true).execute(wrap(res -> {
        if (res.isExists()) {
            final Map<String, Object> source = res.getSourceAsMap();
            final String workingNodeName = (String) source.get(IndexingProxyPlugin.NODE_NAME);
            if (!Strings.isBlank(workingNodeName) && !nodeName().equals(workingNodeName)) {
                listener.onFailure(new ElasticsearchException("RequestSender is working in " + workingNodeName));
            } else {
                final Number pos = (Number) source.get(IndexingProxyPlugin.FILE_POSITION);
                final long value = pos == null ? 1 : pos.longValue();
                launchRequestSender(index, filePosition > 0 ? filePosition : value, res.getVersion(), listener);
            }
        } else {
            launchRequestSender(index, filePosition > 0 ? filePosition : 1, 0, listener);
        }
    }, listener::onFailure));
}
 
开发者ID:codelibs,项目名称:elasticsearch-indexing-proxy,代码行数:26,代码来源:IndexingProxyService.java

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: checkAddresseeFields

import org.apache.logging.log4j.util.Strings; //导入依赖的package包/类
private static void checkAddresseeFields(@NotNull final String sample, @NotNull final CenterData center) {
    final List<String> missingFields = Lists.newArrayList();
    if (getPI(sample, center).isEmpty()) {
        missingFields.add("PI");
    }
    if (center.addressName().isEmpty()) {
        missingFields.add("name");
    }
    if (center.addressZip().isEmpty()) {
        missingFields.add("zip");
    }
    if (center.addressCity().isEmpty()) {
        missingFields.add("city");
    }
    if (!missingFields.isEmpty()) {
        LOGGER.warn("Some address fields (" + Strings.join(missingFields, ',') + ") are missing.");
    }
}
 
开发者ID:hartwigmedical,项目名称:hmftools,代码行数:19,代码来源:CenterModel.java

示例9: canGenerateConsequenceString

import org.apache.logging.log4j.util.Strings; //导入依赖的package包/类
@Test
public void canGenerateConsequenceString() {
    final VariantAnnotation noConsequences = VariantAnnotationTest.createVariantAnnotationBuilder().build();
    assertEquals(Strings.EMPTY, noConsequences.consequenceString());

    final VariantAnnotation oneConsequence = createVariantAnnotationBuilder(VariantConsequence.MISSENSE_VARIANT).build();
    assertEquals(VariantConsequence.MISSENSE_VARIANT.readableSequenceOntologyTerm(), oneConsequence.consequenceString());

    final VariantAnnotation twoConsequences =
            createVariantAnnotationBuilder(VariantConsequence.MISSENSE_VARIANT, VariantConsequence.INFRAME_DELETION).build();
    assertTrue(twoConsequences.consequenceString().contains(VariantConsequence.MISSENSE_VARIANT.readableSequenceOntologyTerm()));
    assertTrue(twoConsequences.consequenceString().contains(VariantConsequence.INFRAME_DELETION.readableSequenceOntologyTerm()));

    final VariantAnnotation twoConsequencesIgnoreOne =
            createVariantAnnotationBuilder(VariantConsequence.MISSENSE_VARIANT, VariantConsequence.OTHER).build();
    assertEquals(VariantConsequence.MISSENSE_VARIANT.readableSequenceOntologyTerm(), twoConsequencesIgnoreOne.consequenceString());
}
 
开发者ID:hartwigmedical,项目名称:hmftools,代码行数:18,代码来源:VariantAnnotationTest.java

示例10: createVariantAnnotationBuilder

import org.apache.logging.log4j.util.Strings; //导入依赖的package包/类
@NotNull
public static ImmutableVariantAnnotation.Builder createVariantAnnotationBuilder(@NotNull VariantConsequence... consequences) {
    return ImmutableVariantAnnotation.builder()
            .allele(Strings.EMPTY)
            .severity(Strings.EMPTY)
            .gene(Strings.EMPTY)
            .geneID(Strings.EMPTY)
            .featureType(Strings.EMPTY)
            .featureID(Strings.EMPTY)
            .transcriptBioType(Strings.EMPTY)
            .rank(Strings.EMPTY)
            .hgvsCoding(Strings.EMPTY)
            .hgvsProtein(Strings.EMPTY)
            .cDNAPosAndLength(Strings.EMPTY)
            .cdsPosAndLength(Strings.EMPTY)
            .aaPosAndLength(Strings.EMPTY)
            .distance(Strings.EMPTY)
            .addition(Strings.EMPTY)
            .consequences(Lists.newArrayList(consequences));
}
 
开发者ID:hartwigmedical,项目名称:hmftools,代码行数:21,代码来源:VariantAnnotationTest.java

示例11: postToSendTransactionEthereum

import org.apache.logging.log4j.util.Strings; //导入依赖的package包/类
public static String postToSendTransactionEthereum(String url, String sender, String receiver, String amount)
        throws IOException {

    try {
        String params = String.format("{\"jsonrpc\":\"2.0\"," +
                "\"method\":\"eth_sendTransaction\",\"params\":[{\"from\":\"%s\",\"to\":\"%s\"," +
                        "\"value\":\"%s\"}],\"id\":%s}",
                sender, receiver, amount, id);
        String responseString = httpHelper.request(url, params, RequestType.POST);
        ObjectMapper mapper = new ObjectMapper();
        JsonNode responseJson = mapper.readTree(responseString);
        return responseJson.get("result").textValue();
    } catch (Exception e) {
        log.error("Cannot run post method for sending transactions in Ethereum", e);
    }

    return Strings.EMPTY;
}
 
开发者ID:dsx-tech,项目名称:blockchain-benchmarking,代码行数:19,代码来源:JSONRPCHelper.java

示例12: postToSendMessageEthereum

import org.apache.logging.log4j.util.Strings; //导入依赖的package包/类
public static String postToSendMessageEthereum(String url, String sender, String receiver, String message, String amount)
        throws IOException {
    try {
        String params = String.format("{\"jsonrpc\":\"2.0\"," +
                        "\"method\":\"eth_sendTransaction\",\"params\":[{\"from\":\"%s\",\"to\":\"%s\"," +
                        "\"value\":\"%s\", \"data\":\"%s\"}],\"id\":%s}",
                sender, receiver, amount, "0x" + Hex.encodeHexString(message.getBytes()), id);

        String responseString = httpHelper.request(url, params, RequestType.POST);
        ObjectMapper mapper = new ObjectMapper();
        JsonNode responseJson = mapper.readTree(responseString);
        return responseJson.get("result").textValue();
    } catch (Exception e) {
        log.error("Cannot run post method for sending transactions in Ethereum", e);
    }

    return Strings.EMPTY;
}
 
开发者ID:dsx-tech,项目名称:blockchain-benchmarking,代码行数:19,代码来源:JSONRPCHelper.java

示例13: findClientImpl

import org.apache.logging.log4j.util.Strings; //导入依赖的package包/类
public static Client findClientImpl(final String httpClientImpl) {
       Client client = null;
if (Strings.isEmpty(httpClientImpl)) {
    for (String s : Arrays.asList("be.olsson.slackappender.client.OkHttp2Client", "be.olsson.slackappender.client.OkHttp3Client")) {
	client = getClientImpl(s);
	if (client != null) {
	    break;
	}
    }
    if (client == null) {
	throw new IllegalArgumentException("Didn't find any working " + Client.class.getName() + " implementation called " + httpClientImpl);
    }
} else {
    client = getClientImpl(httpClientImpl);
    if (client == null) {
	throw new IllegalArgumentException("Didn't find any working " + Client.class.getName() + " implementation called " + httpClientImpl);
    }
}
return client;
   }
 
开发者ID:tobias-,项目名称:slack-appender,代码行数:21,代码来源:SlackAppender.java

示例14: 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

示例15: 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


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