当前位置: 首页>>代码示例>>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;未经允许,请勿转载。