當前位置: 首頁>>代碼示例>>Java>>正文


Java StringUtils.isNotEmpty方法代碼示例

本文整理匯總了Java中org.apache.commons.lang3.StringUtils.isNotEmpty方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.isNotEmpty方法的具體用法?Java StringUtils.isNotEmpty怎麽用?Java StringUtils.isNotEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.lang3.StringUtils的用法示例。


在下文中一共展示了StringUtils.isNotEmpty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parse

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
private Privilege parse(String expression) {
    Privilege privilege = new Privilege();
    privilege.setMsName(appName);
    String[] inputParams = StringUtils.split(expression, ",");

    for (int i = 0; i < inputParams.length; i++) {
        if (i == inputParams.length - 1) {
            if (StringUtils.contains(inputParams[i], "'")) {
                privilege.setKey(StringUtils.substringBetween(inputParams[i], "'")
                    .replace("@msName", appName.toUpperCase()));
            } else {
                privilege.setKey(inputParams[i].replace("@msName", appName.toUpperCase()));
            }
        } else {
            String resource = StringUtils.substringBetween(inputParams[i], "'");
            if (StringUtils.isNotEmpty(resource)) {
                privilege.getResources().add(resource);
            }
        }
    }
    return privilege;
}
 
開發者ID:xm-online,項目名稱:xm-commons,代碼行數:23,代碼來源:PrivilegeScanner.java

示例2: accept

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
@Override
public boolean accept(Object object) {
    // 如果不允許為空的情況下
    if (notNull) {
        if (object instanceof String) {
            if (!isCard((String) object)) {
                return false;
            }
        } else {
            return false;
        }
    } else {
        // 值不為空的時候才進行正則判斷
        if (StringUtils.isNotEmpty((String) object)) {
            if (!isCard((String) object)) {
                return false;
            }
        }
    }

    return true;
}
 
開發者ID:wxz1211,項目名稱:dooo,代碼行數:23,代碼來源:AbstractConditionValidator.java

示例3: isDefined

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
/**
 * 判斷對象是不是定義了 <br>
 * List的話,不為NULL和空<br>
 * 字符串的的話,不為NULL或空<br>
 * Integer的話,不為NULL或0<br>
 * 
 * @param obj
 *            要判斷的對象
 * @return 是否定義了
 */
public static boolean isDefined(Object obj) {
    if (obj instanceof Collection) {
        return CollectionUtils.isNotEmpty((Collection<?>) obj);
    }

    if (obj instanceof Map) {
        return MapUtils.isNotEmpty((Map<?, ?>) obj);
    }

    if (obj instanceof String) {
        return StringUtils.isNotEmpty((String) obj);
    }

    if (obj instanceof Integer) {
        return obj != null && (Integer) obj != 0;
    }

    return obj != null;
}
 
開發者ID:Chihpin,項目名稱:Yidu,代碼行數:30,代碼來源:Utils.java

示例4: generateMapType

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
private static Object generateMapType(ServiceDefinition def, TypeDefinition td, MetadataType metadataType,
                                      Set<String> resolvedTypes) {
    String keyType = StringUtils.substringAfter(td.getType(), "<");
    keyType = StringUtils.substringBefore(keyType, ",");
    keyType = StringUtils.strip(keyType);
    keyType = StringUtils.isNotEmpty(keyType) ? keyType : "java.lang.Object";
    Object key = generateType(def, keyType, metadataType, resolvedTypes);

    String valueType = StringUtils.substringAfter(td.getType(), ",");
    valueType = StringUtils.substringBefore(valueType, ">");
    valueType = StringUtils.strip(valueType);
    valueType = StringUtils.isNotEmpty(valueType) ? valueType : "java.lang.Object";
    Object value = generateType(def, valueType, metadataType, resolvedTypes);

    Map<Object, Object> map = new HashMap<>();
    map.put(key, value);
    return map;
}
 
開發者ID:venus-boot,項目名稱:saluki,代碼行數:19,代碼來源:GenericInvokeUtils.java

示例5: hgetObject

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
@Override
public <T> T hgetObject(final String bizkey, final String nameSpace, final String field, TypeReference<T> type,
        final GetDataCallBack<T> gbs) {
    final String key = CacheUtils.getKeyByNamespace(bizkey, nameSpace);
    String res = hget(bizkey, nameSpace, field, null);
    T rtn = null;
    if (StringUtils.isNotEmpty(res)) {
        rtn = CacheUtils.parseObject(key, res, type);
    } else {
        if (gbs != null) {
            rtn = gbs.invoke();
        }
        if (null != rtn) {
            hsetObject(bizkey, nameSpace, field, rtn);
        }
    }
    return rtn;
}
 
開發者ID:ningyu1,項目名稱:redis-client,代碼行數:19,代碼來源:RedisClientImpl.java

示例6: cast2Int

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
public static int cast2Int(Object obj, int defaultValue) {
    int intValue = defaultValue;
    if (null != obj) {
        String str = cast2String(obj);
        if (StringUtils.isNotEmpty(str)) {
            try {
                intValue = Integer.parseInt(str);
            } catch (NumberFormatException e) {
                intValue = defaultValue;
            }
        }
    }
    return intValue;
}
 
開發者ID:BookFrank,項目名稱:Supreweb,代碼行數:15,代碼來源:CastUtil.java

示例7: isNotEmpty

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
public ParamValidator isNotEmpty(final String val) {
    if (isValid()) {
        valid = StringUtils.isNotEmpty(val);
        return this;
    }
    return this;
}
 
開發者ID:cerner,項目名稱:jwala,代碼行數:8,代碼來源:ParamValidator.java

示例8: actionPerformed

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
@Override
public void actionPerformed(final AnActionEvent e) {
    final Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext());
    if (editor != null) {
        final SelectionModel selectionModel = editor.getSelectionModel();
        final ImportImpexHttpClient client = new ImportImpexHttpClient();
        final String selectedText = selectionModel.getSelectedText();
        if (StringUtils.isNotEmpty(selectedText)) {
            final HybrisHttpResult hybrisHttpResult = client.importImpex(selectedText);

            ExecuteHybrisConsole.getInstance().show(hybrisHttpResult, e.getProject());
        }
    }
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:15,代碼來源:ImportImpexAction.java

示例9: getInternetIp

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
protected String getInternetIp() {
	if (StringUtils.isNotEmpty(this.webip))
		return this.webip;

	this.webip = IpAddressUtil.getInternetIp();

	return this.webip;
}
 
開發者ID:yi-jun,項目名稱:aaden-pay,代碼行數:9,代碼來源:PaymentCommon.java

示例10: syncMee6

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
@Transactional
@Override
public void syncMee6(Guild guild) throws IOException {
    List<RankingInfo> mee6Infos = mee6Provider.export(guild.getIdLong());
    if (CollectionUtils.isNotEmpty(mee6Infos)) {
        List<LocalMember> members = memberService.syncMembers(guild);
        Map<String, LocalMember> membersMap = members.stream()
                .collect(Collectors.toMap(u -> u.getUser().getUserId(), e -> e));
        for (RankingInfo info : mee6Infos) {
            LocalMember member = membersMap.get(info.getId());
            if (member == null) {
                member = new LocalMember();
                member.setGuildId(guild.getId());
                member.setEffectiveName(info.getNick());

                LocalUser user = userRepository.findByUserId(info.getId());
                if (user == null) {
                    user = new LocalUser();
                    user.setUserId(info.getId());
                }
                if (StringUtils.isNotEmpty(info.getAvatarUrl())) {
                    user.setAvatarUrl(info.getAvatarUrl());
                }
                user.setName(info.getName());
                user.setDiscriminator(info.getDiscriminator());
                member.setUser(user);
                userRepository.save(user);
                memberRepository.save(member);
            }
            Ranking ranking = getRanking(member);
            ranking.setExp(info.getTotalExp());
            rankingRepository.save(ranking);
        }
        sync(guild);
    }
}
 
開發者ID:GoldRenard,項目名稱:JuniperBotJ,代碼行數:37,代碼來源:RankingServiceImpl.java

示例11: initialize

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
public void initialize() throws Exception {
    String skin = ObjectUtils.toString(config.get("UISkin")).trim();
    String theme = ObjectUtils.toString(config.get("UITheme")).trim();
    
    if(skin.equalsIgnoreCase("default")) //java default
        return;
    
    UIManager.setLookAndFeel(new SubstanceLookAndFeel());
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    
    if(StringUtils.isNotEmpty(theme))
        SubstanceLookAndFeel.setCurrentTheme(theme);
    else if(StringUtils.isNotEmpty(skin))
        SubstanceLookAndFeel.setSkin((SubstanceSkin)newInstance(skin));
    String watermark = ObjectUtils.toString(config.get("UIWatermark")).trim();
    if(StringUtils.isNotEmpty(watermark))
        SubstanceLookAndFeel.setCurrentWatermark((SubstanceWatermark)newInstance(watermark));
    String buttonShaper = ObjectUtils.toString(config.get("UIButtonShaper")).trim();
    if(StringUtils.isNotEmpty(buttonShaper))
        SubstanceLookAndFeel.setCurrentButtonShaper((SubstanceButtonShaper)newInstance(buttonShaper));
    String borderPainter = ObjectUtils.toString(config.get("UIBorderPainter")).trim();
    if(StringUtils.isNotEmpty(borderPainter))
        SubstanceLookAndFeel.setCurrentBorderPainter((SubstanceBorderPainter)newInstance(borderPainter));
    String gradientPainter = ObjectUtils.toString(config.get("UIGradientPainter")).trim();
    if(StringUtils.isNotEmpty(gradientPainter))
        SubstanceLookAndFeel.setCurrentGradientPainter((SubstanceGradientPainter)newInstance(gradientPainter));
}
 
開發者ID:hulang1024,項目名稱:PTEAssistant,代碼行數:29,代碼來源:SkinManager.java

示例12: filterS3Objects

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
private List<S3Object> filterS3Objects(List<S3Object> objects, String marker, String prefix,
    int maxObjects) {
  int skip = 0;
  if (StringUtils.isNotEmpty(marker)) {
    skip = IntStream.range(0, objects.size())
        .filter(index -> !StringUtils.equals(objects.get(index).getKey(), marker)).findFirst()
        .orElse(0);
  }
  return objects.stream().filter(s3Object -> hasObjectKeyPrefixIfExists(prefix, s3Object))
      .skip(skip).limit(maxObjects).collect(Collectors.toList());
}
 
開發者ID:daflockinger,項目名稱:unitstack,代碼行數:12,代碼來源:ListObjectsResponder.java

示例13: process

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
/**
 * Use the "sort" query parameter to sort a list of entities.
 * - Chains sorting directives in order of appearance
 * - Supports sorting on sub-properties by providing the path as "Property.SubProperty".
 *
 * @param entities    The list of entities to sort
 * @param queryParams A map with the value of the "sort" query parameter
 * @return The sorted list of entities
 * @throws IOException When Jackson is unnable to unmarshal the sorting directives
 */

@Override
public List<T> process(List<T> entities, Map<String, Object> queryParams) throws Exception {
  if (entities.size() > 1 && queryParams.containsKey(PARAM_NAME_SORT)) {
    try {
      String sorters = (String) queryParams.get(PARAM_NAME_SORT);
      Collection<RestSortDirective> sortDirectives = null;
      // noinspection unchecked This error is inevitable depending on user input
      Class<T> rootClass = (Class<T>) entities.get(0).getClass();

      if (StringUtils.isNotEmpty(sorters)) {
        sortDirectives = JacksonMarshaller.unmarshalCollection(sorters, RestSortDirective.class);
      }

      if (sortDirectives != null && sortDirectives.size() > 0) {
        Comparator<T> comparatorChain = buildComparatorChain(sortDirectives, rootClass);

        //noinspection unchecked ComparatorChain implements Comparator
        entities.sort(comparatorChain);
      }
    } catch (Exception e) {
      LogManager.getLogger(this.getClass()).error(e);
      throw e;
    }
  }

  return entities;
}
 
開發者ID:Juraji,項目名稱:Biliomi,代碼行數:39,代碼來源:SortDirectiveQueryProcessor.java

示例14: process

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
public void process(TBuildType buildType, BundleConfig bundleConfig) throws Exception {

        String propfile = EnvHelper.getEnv("awoprop");

        if (StringUtils.isEmpty(propfile)) {
            return;
        }

        Properties properties = new Properties();
        properties.load(new FileInputStream(propfile));

        String ap_path = properties.getProperty(AP_PATH);
        boolean refresh_ap = "true".equals(properties.getProperty(REFRESH_AP));
        String mtl_url = properties.getProperty(MTL_URL);

        if (!refresh_ap && StringUtils.isNotEmpty(ap_path) && new File(ap_path).exists()) {
            //not need download
            System.out.println("[awo] ap file exist");
        }

        if (StringUtils.isEmpty(mtl_url)) {
            throw new StopExecutionException("mtl_url is not configed");
        }

        ap_path = ApDownloader.downloadAP(mtl_url, new File(propfile).getParentFile()).getAbsolutePath();
        properties.setProperty(AP_PATH, ap_path);
        properties.store(new FileOutputStream(propfile), "update path");

        buildType.setBaseApFile(new File(ap_path));

        bundleConfig.setAwoBuildEnabled(true);
        bundleConfig.setAwoDynDeploy("true".equals(properties.getProperty(SUPPORT_DYN, "true")));
        bundleConfig.setAwoApkBuild("true".equals(properties.getProperty(SUPPORT_APK, "true")));
    }
 
開發者ID:alibaba,項目名稱:atlas,代碼行數:35,代碼來源:AwoPropHandler.java

示例15: setFallback

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
/**
 * Sets fallback.
 *
 * @param restyService the resty service
 * @param properties   the properties
 */
protected void setFallback(RestyService restyService, RestyCommandConfig properties) {
    properties.setFallbackEnabled(restyService.fallbackEnabled());

    //fallback class
    properties.setFallbackClass(restyService.fallbackClass());
    // com.github.df.restypass.servertest.entity name
    if (StringUtils.isNotEmpty(restyService.fallbackBean())) {
        properties.setFallbackBean(restyService.fallbackBean());
    }
}
 
開發者ID:darren-fu,項目名稱:RestyPass,代碼行數:17,代碼來源:RestyServiceProcessor.java


注:本文中的org.apache.commons.lang3.StringUtils.isNotEmpty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。