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


Java StringUtils.isNoneEmpty方法代码示例

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


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

示例1: addEndpoint

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public void addEndpoint(Endpoint e) {
	LOGGER.debug("Añadiendo endpoint: {}", e);
	String[] relatives = e.getUrl().trim().split("/");
	int i = 0;
	String path = "";
	boolean isPathVariable = false;
	while (i < relatives.length && !isPathVariable) {
		String relative = relatives[i++];
		isPathVariable = relative.contains("{");
		if (StringUtils.isNoneEmpty(relative) && !isPathVariable) {
			path = path + "/" + relative;
			if (!path.matches("/public|/private|/private/v1|/public/v1")) {
				Resource resource = this.resources.get(path);
				if (resource == null) {
					resource = new Resource();
				}
				resource.addEndpoint(e);
				this.resources.put(path, resource);
			}
		}

	}
}
 
开发者ID:damianwajser,项目名称:spring-rest-commons-options,代码行数:24,代码来源:CollectionResources.java

示例2: getUserData

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public Map<String, String> getUserData(String instanceId) throws Exception {
  Preconditions.checkNotNull(instanceId);

  awsRateLimiter.acquire();
  OperationStats op = new OperationStats("ec2InstanceStore", "getUserData");
  try {
    InstanceAttribute
        attribute =
        this.getInstanceAttribute(instanceId, "userData");
    if (attribute != null) {
      String base64EncodedString = attribute.getUserData();
      if (StringUtils.isNoneEmpty(base64EncodedString)) {
        Map<String, String> userData = Ec2InstanceStore.parseEc2UserData(base64EncodedString);
        op.succeed();
        return userData;
      }
    }
  } catch (Exception ex) {
    op.failed();
    throw ex;
  }
  op.succeed();
  return new HashMap<>();
}
 
开发者ID:pinterest,项目名称:soundwave,代码行数:26,代码来源:Ec2InstanceStore.java

示例3: modifyGroup

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public Response modifyGroup(GroupDTO request) {

        Set<Long> permissions = request.getPermissions().stream().
            map(permission -> permission.getId()).collect(Collectors.toSet());
        Set<Long> roles = request.getRoles().stream().
            map(role -> role.getId()).collect(Collectors.toSet());

        String error = validateRolesAndPermissions(permissions, roles);
        if (StringUtils.isNoneEmpty(error)) {
            throw new WebApplicationException(
                error,
                Response.Status.BAD_REQUEST);
        }

        Group group = getGroup(request.getGroupID());
        if(group.getGroupType() == GroupType.PRIVATE)
        {
            throw new WebApplicationException(
                GroupErrorMessages.MODIFY_PRIVATE_GROUP,
                Response.Status.BAD_REQUEST);
        }

        group.setIsActive(request.isActive());
        return updateOrCreateGroup(group, permissions, roles);
    }
 
开发者ID:tosinoni,项目名称:SECP,代码行数:26,代码来源:GroupController.java

示例4: getSeesion

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public String getSeesion(final String sessionId) {
    try {
        String session = (String) this.redisConfig.execute(new RedisCallback<String>() {
            @Override
            public String call(Jedis jedis) {
                return jedis.get(sessionId);
            }
        });
        if (StringUtils.isNoneEmpty(new CharSequence[]{session})) {
            this.updateExpiredTime(sessionId);
        }

        return session;
    } catch (Exception var3) {
        LOGGER.error("getSeesion failed, sessionId[" + sessionId + "]", var3);
        return null;
    }
}
 
开发者ID:wxz1211,项目名称:dooo,代码行数:20,代码来源:RedisSessionDao.java

示例5: updateOrCreateFilter

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public Response updateOrCreateFilter(FilterCreateRequest request)
{
    Set<Long> permissions = request.permissions.stream().
        map(permission -> permission.getId()).collect(Collectors.toSet());
    Set<Long> roles = request.roles.stream().
        map(role -> role.getId()).collect(Collectors.toSet());
    String error = validateCreateRequest(request.name,permissions,roles);
    if(StringUtils.isNoneEmpty(error))
    {
            throw new WebApplicationException(
                error,
                Response.Status.BAD_REQUEST);
    }

    Filter filter = new Filter(request.name);
    return updateOrCreateFilter(filter,permissions,roles);
}
 
开发者ID:tosinoni,项目名称:SECP,代码行数:18,代码来源:FilterController.java

示例6: toHttpUriRequest

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public HttpUriRequest toHttpUriRequest() {
    LOGGER.debug("in createRequestBuilder");
    RequestBuilder requestBuilder = createRequestBuilder();
    int timeout = httpServiceInfo.getTimeout();
    RequestConfig.Builder requestConfigBuilder = RequestConfig.custom()
            .setConnectionRequestTimeout(timeout)
            .setSocketTimeout(timeout)
            .setConnectTimeout(timeout)
            .setCookieSpec(CookieSpecs.IGNORE_COOKIES);

    requestBuilder.setConfig(requestConfigBuilder.build());
    if (StringUtils.isNoneEmpty(httpServiceInfo.getContentType())) {
        requestBuilder.addHeader("Content-Type", httpServiceInfo.getContentType());
    } else {
        requestBuilder.addHeader("Content-Type", httpServletRequest.getContentType());
    }
    return requestBuilder.build();
}
 
开发者ID:wxz1211,项目名称:dooo,代码行数:19,代码来源:HttpServiceRequest.java

示例7: getNodeAddress

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private String getNodeAddress(ClusterNodeAddress ownAddress) {
    if (StringUtils.isNoneEmpty(configuration.getNodeAddress())) {
        return configuration.getNodeAddress();
    } else {
        return ownAddress.getHost();
    }
}
 
开发者ID:pellepelster,项目名称:hivemq-consul-cluster-discovery,代码行数:8,代码来源:ConsulDiscoveryCallback.java

示例8: createPublicGroup

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public Response createPublicGroup(GroupCreateRequest request) {
    Set<Long> permissions = request.permissions.stream().
        map(permission -> permission.getId()).collect(Collectors.toSet());
    Set<Long> roles = request.roles.stream().
        map(role -> role.getId()).collect(Collectors.toSet());
    String error = validateCreateRequest(request.name, permissions, roles);
    if (StringUtils.isNoneEmpty(error)) {
        throw new WebApplicationException(
            error,
            Response.Status.BAD_REQUEST);
    }

    Group group = new Group(request.name);
    return updateOrCreateGroup(group, permissions, roles);
}
 
开发者ID:tosinoni,项目名称:SECP,代码行数:16,代码来源:GroupController.java

示例9: validateRolesAndPermissions

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private String validateRolesAndPermissions(Set<Long> permissions, Set<Long> roles) {

        String roleError = validateRoles(roles);
        if (StringUtils.isNoneEmpty(roleError))
            return roleError;

        String permissionError = validatePermissions(permissions);
        if (StringUtils.isNoneEmpty(permissionError))
            return permissionError;

        return StringUtils.EMPTY;
    }
 
开发者ID:tosinoni,项目名称:SECP,代码行数:13,代码来源:GroupController.java

示例10: registerRoles

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public Response registerRoles(AppCreateDTO request) {
    String error = validateCreateRolesRequest(request);
    if(StringUtils.isNoneEmpty(error))
    {
        throw new WebApplicationException(error, Response.Status.BAD_REQUEST);
    }

    Set<RolesOrPermissionDTO> response = new HashSet<>();
    for (String name : request.getRoles()) {
        Role role = rolesDAO.save(new Role(name, request.getColor()));
        response.add(new RolesOrPermissionDTO(role.getId(), role.getRole(), role.getColor()));
    }

    return Response.status(Response.Status.CREATED).entity(response).build();
}
 
开发者ID:tosinoni,项目名称:SECP,代码行数:16,代码来源:AdminController.java

示例11: registerPermissions

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public Response registerPermissions(AppCreateDTO request) {
    String error = validateCreatePermissionsRequest(request);
    if(StringUtils.isNoneEmpty(error))
    {
        throw new WebApplicationException(error, Response.Status.BAD_REQUEST);
    }

    Set<RolesOrPermissionDTO> response = new HashSet<>();
    for (String name : request.getPermissions()) {
        Permission permission = permissionDAO.save(new Permission(name, request.getColor()));
        response.add(new RolesOrPermissionDTO(permission.getId(), permission.getLevel(), permission.getColor()));
    }

    return Response.status(Response.Status.CREATED).entity(response).build();
}
 
开发者ID:tosinoni,项目名称:SECP,代码行数:16,代码来源:AdminController.java

示例12: setDisplayName

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * set displayName
 * <p>
 * validate display length before set the value
 *
 * @param displayName the displayName to set
 */
public void setDisplayName(String displayName) {

    if (StringUtils.isNoneEmpty(displayName)) {
        if (ValidationUtil.validateDisplayName(displayName)) {
            this.displayName = displayName;
        } else {
            throw new RuntimeException("Display name is oversized.");
        }
    } else {
        this.displayName = displayName;
    }
}
 
开发者ID:SimpleMessageNotification,项目名称:smn-sdk-java,代码行数:20,代码来源:CreateTopicRequest.java

示例13: checkFileExists

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public Map<String, String> checkFileExists(final String groupName, final String jvmName, final String webappName, final String webserverName, final String fileName) {
    boolean resultBoolean = false;
    if (StringUtils.isNotEmpty(groupName) && StringUtils.isNoneEmpty(fileName)) {
        if (jvmName != null && !jvmName.isEmpty()) {
            // Search for file in jvms
            LOGGER.debug("Searching for resource {} in group {} and jvm {}", fileName, groupName, jvmName);
            resultBoolean = groupPersistenceService.checkGroupJvmResourceFileName(groupName, fileName) ||
                    jvmPersistenceService.checkJvmResourceFileName(groupName, jvmName, fileName);
        } else if (webappName != null && !webappName.isEmpty()) {
            // Search for file in webapps
            LOGGER.debug("Searching for resource {} in group {} and webapp {}", fileName, groupName, webappName);
            resultBoolean = groupPersistenceService.checkGroupAppResourceFileName(groupName, fileName) ||
                    applicationPersistenceService.checkAppResourceFileName(groupName, webappName, fileName);
        } else if (webserverName != null && !webserverName.isEmpty()) {
            // Search for file in webservers
            LOGGER.debug("Searching for resource {} in group {} and webserver {}", fileName, groupName, webserverName);
            resultBoolean = groupPersistenceService.checkGroupWebServerResourceFileName(groupName, fileName) ||
                    webServerPersistenceService.checkWebServerResourceFileName(groupName, webserverName, fileName);
        }
    }
    Map<String, String> result = new HashMap<>();
    result.put("fileName", fileName);
    result.put("exists", Boolean.toString(resultBoolean));
    LOGGER.debug("result: {}", result.toString());
    return result;
}
 
开发者ID:cerner,项目名称:jwala,代码行数:28,代码来源:ResourceServiceImpl.java

示例14: Plain

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@SuppressWarnings("WeakerAccess")
public Plain(String json) {
    List<JsonTable> list = new ArrayList<>();
    if (StringUtils.isNoneEmpty(json)) {
        final JsonParser parser = new JsonParser();
        final JsonObject jsonObject = parser.parse(json).getAsJsonObject();
        for (Map.Entry<String, JsonElement> e : jsonObject.entrySet()) {
            if (e.getValue().isJsonArray()) {
                list.add(new JsonTable(e.getKey(), e.getValue().getAsJsonArray()));
            }
        }
    }
    jsonLength = json.length();
    iterator = list.iterator();
}
 
开发者ID:terma,项目名称:sql-on-json,代码行数:16,代码来源:Plain.java

示例15: showCart

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@RequestMapping("/cart")
public String showCart( HttpServletRequest request, HttpServletResponse response,Model model) {

    String cookieUUID = CookieUtils.getCookieValue(request, Const.CART_KEY);
    String tokenLogin = CookieUtils.getCookieValue(request, Const.TOKEN_LOGIN);

    TbUser user = null;
    String userJson = null;
    if (StringUtils.isNoneEmpty(tokenLogin)) {

        try {
            userJson = jedisClient.get(USER_SESSION + tokenLogin);
        } catch (Exception e) {
            logger.error("Redis 错误", e);
        }

        if (StringUtils.isNoneEmpty(userJson)) {
            user = FastJsonConvert.convertJSONToObject(userJson, TbUser.class);
        }
        model.addAttribute("user", user);
    } else {
        model.addAttribute("user", user);
    }

    List<CartInfo> cartInfos = new ArrayList<>();
    if (StringUtils.isNoneEmpty(cookieUUID)) {
        cartInfos= cartService.getCartInfoListByCookiesId(cookieUUID);
    }

    if (cartInfos.size() == 0) {
        model.addAttribute("cartInfos", null);
        return "cart";
    }

    int totalPrice = 0;

    for (int i = 0; i < cartInfos.size(); i++) {
        CartInfo cartInfo = cartInfos.get(i);
        totalPrice += cartInfo.getSum();
    }

    model.addAttribute("cartInfos", cartInfos);
    model.addAttribute("totalPrice", totalPrice);

    return "cart";
}
 
开发者ID:xubinux,项目名称:xbin-store,代码行数:47,代码来源:CartController.java


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