本文整理汇总了Java中org.apache.commons.lang3.StringUtils.isNoneBlank方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.isNoneBlank方法的具体用法?Java StringUtils.isNoneBlank怎么用?Java StringUtils.isNoneBlank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.StringUtils
的用法示例。
在下文中一共展示了StringUtils.isNoneBlank方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGroup
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private String getGroup(SalukiReference reference, String serviceName, Class<?> referenceClass) {
Pair<String, String> groupVersion = findGroupAndVersionByServiceName(serviceName);
if (StringUtils.isNoneBlank(reference.group())) {
return reference.group();
} else if (StringUtils.isNoneBlank(groupVersion.getLeft())) {
String replaceGroup = groupVersion.getLeft();
Matcher matcher = REPLACE_PATTERN.matcher(replaceGroup);
if (matcher.find()) {
String replace = matcher.group().substring(2, matcher.group().length() - 1).trim();
String[] replaces = StringUtils.split(replace, ":");
if (replaces.length == 2) {
String realGroup = env.getProperty(replaces[0], replaces[1]);
return realGroup;
} else {
throw new IllegalArgumentException("replaces formater is #{XXXgroup:groupName}");
}
} else {
return replaceGroup;
}
} else if (this.isGenericClient(referenceClass)) {
return StringUtils.EMPTY;
}
throw new java.lang.IllegalArgumentException(String
.format("reference group can not be null or empty,the servicName is %s", serviceName));
}
示例2: checkValid
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public ServerResponse<String> checkValid(String str, String type) {
//isNoneBlank:表示null;"";" "都返回false
//isNoneEmpty:表示null;""返回false;而" "返回true
if (StringUtils.isNoneBlank(type)) {
if (Const.USERNAME.equals(type)) {
int resultCount = userMapper.checkUsername(str);
if (resultCount > 0) {
return ServerResponse.createByError("用户名已存在");
}
}
if (Const.EMAIL.equals(type)) {
int resultEmailCount = userMapper.checkEmail(str);
if (resultEmailCount > 0) {
return ServerResponse.createByError("邮箱已存在");
}
}
}else {
return ServerResponse.createByError("参数错误");
}
return ServerResponse.createBySuccess();
}
示例3: doConnect
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public void doConnect() {
if (channel != null && channel.isActive()) {
return;
}
final TxManagerServer txManagerServer = TxManagerLocator.getInstance().locator();
if (Objects.nonNull(txManagerServer) &&
StringUtils.isNoneBlank(txManagerServer.getHost())
&& Objects.nonNull(txManagerServer.getPort())) {
host = txManagerServer.getHost();
port = txManagerServer.getPort();
}
ChannelFuture future = bootstrap.connect(host, port);
LogUtil.info(LOGGER, "连接txManager-socket服务-> host:port:{}", () -> host + ":" + port);
future.addListener((ChannelFutureListener) futureListener -> {
if (futureListener.isSuccess()) {
channel = futureListener.channel();
LogUtil.info(LOGGER, "Connect to server successfully!-> host:port:{}", () -> host + ":" + port);
} else {
LogUtil.info(LOGGER, "Failed to connect to server, try connect after 5s-> host:port:{}", () -> host + ":" + port);
futureListener.channel().eventLoop().schedule(this::doConnect, 5, TimeUnit.SECONDS);
}
});
}
示例4: getNewApkFileList
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* 获取新版本的apkFileList
*
* @return
*/
public ApkFileList getNewApkFileList() {
String newApkFileListStr = null;
try {
if (null != input.newApkFileList && input.newApkFileList.exists()) {
newApkFileListStr = FileUtils.readFileToString(input.newApkFileList);
if (StringUtils.isNoneBlank(newApkFileListStr)) {
return JSON.parseObject(newApkFileListStr, ApkFileList.class);
}
}
} catch (IOException e) {
}
return null;
}
示例5: methodImplementionToCode
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* 将方法的实现转换为smali代码
*
* @param dexBackedMethodImplementation
* @param withLineNo 是否包含行号
* @return
*/
public static String methodImplementionToCode(DexBackedMethodImplementation dexBackedMethodImplementation, boolean withLineNo) {
if (null == dexBackedMethodImplementation) {
return null;
}
StringWriter stringWriter = new StringWriter();
IndentingWriter writer = new IndentingWriter(stringWriter);
MethodDefinition methodDefinition = new MethodDefinition(toClassDefinition(dexBackedMethodImplementation),
dexBackedMethodImplementation.method,
dexBackedMethodImplementation);
try {
methodDefinition.writeTo(writer);
} catch (IOException e) {
throw new RuntimeException(e.getMessage(), e);
}
if (withLineNo) {
return stringWriter.toString();
} else {
List<String> codes = Lists.newArrayList();
String[] lines = StringUtils.split(stringWriter.toString(), "\n");
for (String line : lines) {
if (StringUtils.isNoneBlank(line) && !line.matches("\\s+\\.line\\s+[0-9]+$")) {
codes.add(line);
}
}
return StringUtils.join(codes, "\n");
}
}
示例6: handleClick
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private void handleClick(Event event) {
String url = urlField.getText();
String keyspace = keyspaceField.getText();
if (StringUtils.isNoneBlank(url, keyspace)) {
valueHandler.onConnectionData(new ConnectionData(url, keyspace,
credentials.getUsername(), credentials.getPassword()));
close();
}
}
示例7: getAtUser
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static List<String> getAtUser(String str){
Pattern p = Pattern.compile("(?<[email protected]).*?(?= )");
Matcher m = p.matcher(str);
List<String> result=new ArrayList<String>();
while(m.find()){
if(StringUtils.isNoneBlank(m.group().trim())){
result.add(m.group().trim());
}
}
return result;
}
示例8: findAll
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* Get all the xmEntities.
*
* @param pageable the pagination information
* @return the list of entities
*/
@LogicExtensionPoint("FindAll")
@Override
@Transactional(readOnly = true)
public Page<XmEntity> findAll(Pageable pageable, String typeKey) {
log.debug("Request to get all XmEntities");
if (StringUtils.isNoneBlank(typeKey)) {
Set<String> typeKeys = xmEntitySpecService.findNonAbstractTypesByPrefix(typeKey).stream()
.map(TypeSpec::getKey).collect(Collectors.toSet());
log.debug("Find by typeKeys {}", typeKeys);
return xmEntityRepository.findAllByTypeKeyIn(pageable, typeKeys);
} else {
return xmEntityRepository.findAll(pageable);
}
}
示例9: get
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public T get(Object key) {
Objects.requireNonNull(key);
String value = jedis.hget(nameSpace, key.toString());
if (StringUtils.isNoneBlank(value)) {
return gson.fromJson(value, clazz);
}
return null;
}
示例10: create
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static ProcessingData create(Conversation conversation){
AnalyzedTextBuilder atb = AnalyzedText.build();
int numMessages = conversation.getMessages().size();
boolean first = true;
for(int i=0;i < numMessages; i++){
Message message = conversation.getMessages().get(i);
if(StringUtils.isNoneBlank(message.getContent())){
Section section = atb.appendSection(first ? null : "\n", message.getContent(), "\n");
section.addAnnotation(MESSAGE_IDX_ANNOTATION, i);
section.addAnnotation(MESSAGE_ANNOTATION, message);
first = false;
} //else ignore blank messages for analysis
}
return new ProcessingData(conversation, atb.create());
}
示例11: interceptor
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public Object interceptor(ProceedingJoinPoint pjp) throws Throwable {
final String context = RpcContext.getContext().getAttachment(CommonConstant.TCC_TRANSACTION_CONTEXT);
TccTransactionContext tccTransactionContext;
if (StringUtils.isNoneBlank(context)) {
tccTransactionContext =
GsonUtils.getInstance().fromJson(context, TccTransactionContext.class);
} else {
tccTransactionContext = TransactionContextLocal.getInstance().get();
}
return tccTransactionAspectService.invoke(tccTransactionContext, pjp);
}
示例12: listByPage
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* 分页获取补偿事务信息
*
* @param query 查询条件
* @return CommonPager<TransactionRecoverVO>
*/
@Override
public CommonPager<TransactionRecoverVO> listByPage(RecoverTransactionQuery query) {
CommonPager<TransactionRecoverVO> voCommonPager = new CommonPager<>();
final int currentPage = query.getPageParameter().getCurrentPage();
final int pageSize = query.getPageParameter().getPageSize();
int start = (currentPage - 1) * pageSize;
final String rootPath = RepositoryPathUtils.buildZookeeperPath(query.getApplicationName());
List<String> zNodePaths;
List<TransactionRecoverVO> voList;
int totalCount;
try {
//如果只查 重试条件的
if (StringUtils.isBlank(query.getTxGroupId()) && Objects.nonNull(query.getRetry())) {
zNodePaths = zooKeeper.getChildren(rootPath, false);
final List<TransactionRecoverVO> all = findAll(zNodePaths, rootPath);
final List<TransactionRecoverVO> collect =
all.stream()
.filter(vo -> vo.getRetriedCount() < query.getRetry())
.collect(Collectors.toList());
totalCount = collect.size();
voList = collect.stream().skip(start).limit(pageSize).collect(Collectors.toList());
} else if (StringUtils.isNoneBlank(query.getTxGroupId()) && Objects.isNull(query.getRetry())) {
zNodePaths = Lists.newArrayList(query.getTxGroupId());
totalCount = zNodePaths.size();
voList = findAll(zNodePaths, rootPath);
} else if (StringUtils.isNoneBlank(query.getTxGroupId()) && Objects.nonNull(query.getRetry())) {
zNodePaths = Lists.newArrayList(query.getTxGroupId());
totalCount = zNodePaths.size();
voList = findAll(zNodePaths, rootPath)
.stream()
.filter(vo -> vo.getRetriedCount() < query.getRetry())
.collect(Collectors.toList());
} else {
zNodePaths = zooKeeper.getChildren(rootPath, false);
totalCount = zNodePaths.size();
voList = findByPage(zNodePaths, rootPath, start, pageSize);
}
voCommonPager.setPage(PageHelper.buildPage(query.getPageParameter(), totalCount));
voCommonPager.setDataList(voList);
} catch (Exception e) {
e.printStackTrace();
}
return voCommonPager;
}
开发者ID:yu199195,项目名称:happylifeplat-transaction,代码行数:60,代码来源:ZookeeperRecoverTransactionServiceImpl.java
示例13: listByPage
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* 分页获取补偿事务信息
*
* @param query 查询条件
* @return CommonPager<TransactionRecoverVO>
*/
@Override
public CommonPager<TccCompensationVO> listByPage(CompensationQuery query) {
CommonPager<TccCompensationVO> voCommonPager = new CommonPager<>();
final int currentPage = query.getPageParameter().getCurrentPage();
final int pageSize = query.getPageParameter().getPageSize();
int start = (currentPage - 1) * pageSize;
final String rootPath = RepositoryPathUtils.buildZookeeperPathPrefix(query.getApplicationName());
List<String> zNodePaths;
List<TccCompensationVO> voList;
int totalCount;
try {
//如果只查 重试条件的
if (StringUtils.isBlank(query.getTransId()) && Objects.nonNull(query.getRetry())) {
zNodePaths = zooKeeper.getChildren(rootPath, false);
final List<TccCompensationVO> all = findAll(zNodePaths, rootPath);
final List<TccCompensationVO> collect =
all.stream()
.filter(vo -> vo.getRetriedCount() < query.getRetry())
.collect(Collectors.toList());
totalCount = collect.size();
voList = collect.stream().skip(start).limit(pageSize).collect(Collectors.toList());
} else if (StringUtils.isNoneBlank(query.getTransId()) && Objects.isNull(query.getRetry())) {
zNodePaths = Lists.newArrayList(query.getTransId());
totalCount = zNodePaths.size();
voList = findAll(zNodePaths, rootPath);
} else if (StringUtils.isNoneBlank(query.getTransId()) && Objects.nonNull(query.getRetry())) {
zNodePaths = Lists.newArrayList(query.getTransId());
totalCount = zNodePaths.size();
voList = findAll(zNodePaths, rootPath)
.stream()
.filter(vo -> vo.getRetriedCount() < query.getRetry())
.collect(Collectors.toList());
} else {
zNodePaths = zooKeeper.getChildren(rootPath, false);
totalCount = zNodePaths.size();
voList = findByPage(zNodePaths, rootPath, start, pageSize);
}
voCommonPager.setPage(PageHelper.buildPage(query.getPageParameter(), totalCount));
voCommonPager.setDataList(voList);
} catch (Exception e) {
e.printStackTrace();
}
return voCommonPager;
}
示例14: listByPage
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* 分页获取补偿事务信息
*
* @param query 查询条件
* @return CommonPager<TransactionRecoverVO>
*/
@Override
public CommonPager<TccCompensationVO> listByPage(CompensationQuery query) {
CommonPager<TccCompensationVO> commonPager = new CommonPager<>();
final String redisKeyPrefix = RepositoryPathUtils.buildRedisKeyPrefix(query.getApplicationName());
final int currentPage = query.getPageParameter().getCurrentPage();
final int pageSize = query.getPageParameter().getPageSize();
int start = (currentPage - 1) * pageSize;
//transaction:compensate:alipay-service:
//获取所有的key
Set<byte[]> keys;
List<TccCompensationVO> voList;
int totalCount;
//如果只查 重试条件的
if (StringUtils.isBlank(query.getTransId()) && Objects.nonNull(query.getRetry())) {
keys = jedisClient.keys((redisKeyPrefix + "*").getBytes());
final List<TccCompensationVO> all = findAll(keys);
final List<TccCompensationVO> collect =
all.stream()
.filter(vo -> vo.getRetriedCount() < query.getRetry())
.collect(Collectors.toList());
totalCount = collect.size();
voList = collect.stream().skip(start).limit(pageSize).collect(Collectors.toList());
} else if (StringUtils.isNoneBlank(query.getTransId()) && Objects.isNull(query.getRetry())) {
keys = Sets.newHashSet(String.join(":", redisKeyPrefix, query.getTransId()).getBytes());
totalCount = keys.size();
voList = findAll(keys);
} else if (StringUtils.isNoneBlank(query.getTransId()) && Objects.nonNull(query.getRetry())) {
keys = Sets.newHashSet(String.join(":", redisKeyPrefix, query.getTransId()).getBytes());
totalCount = keys.size();
voList = findAll(keys)
.stream()
.filter(vo -> vo.getRetriedCount() < query.getRetry())
.collect(Collectors.toList());
} else {
keys = jedisClient.keys((redisKeyPrefix + "*").getBytes());
if (keys.size() <= 0 || keys.size() < start) {
return commonPager;
}
totalCount = keys.size();
voList = findByPage(keys, start, pageSize);
}
if (keys.size() <= 0 || keys.size() < start) {
return commonPager;
}
commonPager.setPage(PageHelper.buildPage(query.getPageParameter(), totalCount));
commonPager.setDataList(voList);
return commonPager;
}
示例15: getRequestUri
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* 获取带参数的url链接
*
* @return URI
* @throws URISyntaxException exception
*/
private URL getRequestUri(HttpServletRequest request, Method method, Class controllerClass, String mappingUrl, Map<String, String[]> filterParam)
throws URISyntaxException, UnsupportedEncodingException, MalformedURLException, GenericException {
PipeConfig controllerPipeConfig = (PipeConfig) controllerClass.getAnnotation(PipeConfig.class);
String requestUri = request.getRequestURI();
log.debug("requestUri:{}", requestUri);
String finalRequestUrl = mappingUrl;
PipeConfig pipeConfig = method.getAnnotation(PipeConfig.class);
if (pipeConfig != null && StringUtils.isNoneBlank(pipeConfig.clientUrl())) {
finalRequestUrl = pipeConfig.clientUrl();
}
String requestHost = null;
if (controllerPipeConfig != null && StringUtils.isNoneBlank(controllerPipeConfig.clientHost())) {
requestHost = env.getProperty(controllerPipeConfig.clientHost());
}
if (pipeConfig != null && StringUtils.isNoneBlank(pipeConfig.clientHost())) {
requestHost = env.getProperty(pipeConfig.clientHost());
}
if (requestHost == null) {
throw new GenericException("1911003", "透传Host不能为空");
}
URL url = new URL(requestHost);
String path = url.getPath();
if (path.startsWith("/")) {
path = path.substring(1);
}
if (path.endsWith("/")) {
path = path.substring(0, path.length() - 1);
}
//get a map which have many <key,value> like <"{orderNumber}","123">
Map<String, String> paramMap = getPathParamMap(mappingUrl, requestUri);
for (Map.Entry<String, String> entry : paramMap.entrySet()) {
finalRequestUrl = finalRequestUrl.replace(entry.getKey(), entry.getValue());
}
if (finalRequestUrl.startsWith("/")) {
finalRequestUrl = finalRequestUrl.substring(1);
}
log.debug("finalRequestUri:{}", finalRequestUrl);
HttpUrl.Builder builder = getBuilder(url, path, finalRequestUrl, filterParam);
return builder.build().url();
}