當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。