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


Java NumberUtils.isNumber方法代码示例

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


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

示例1: docsToUsers

import org.apache.commons.lang3.math.NumberUtils; //导入方法依赖的package包/类
/**
 * Converts the given {@link DocumentsSearchResult} to a {@link ISearchResult} containing
 * the found {@link User}s. It extracts all user ids from the {@link Document}s
 * and queries the database for them.
 * @param docsResult the {@link DocumentsSearchResult} to convert.
 * @return {@link ISearchResult} containing the {@link User}s.
 */
private ISearchResult<User> docsToUsers(final DocumentsSearchResult docsResult) {
	final List<Long> userIds = new ArrayList<>();

	for (final Document doc : docsResult.getResults()) {
		final String userId = doc.get(IIndexElement.FIELD_ID);
		if(NumberUtils.isNumber(userId)) {
			userIds.add(Long.valueOf(userId));
		}
		else {
			LOGGER.error("Not numeric user id from index {}.", userId);
		}
	}

	// no results -> return empty ISearchResult
	if(userIds.isEmpty()) {
		return new SimpleSearchResult<User>(new ArrayList<User>(), docsResult.getTotalHits());
	}

	return new SimpleSearchResult<>(DSL.using(jooqConfig).
			select().
			from(TABLE).
			where(TABLE.ID.in(userIds)).
			orderBy(DSL.field("FIELD(id, " + StringUtils.join(userIds, ", ") + ")", Long.class)).
			fetchInto(User.class), docsResult.getTotalHits());
}
 
开发者ID:XMBomb,项目名称:InComb,代码行数:33,代码来源:UserDao.java

示例2: docsToProviders

import org.apache.commons.lang3.math.NumberUtils; //导入方法依赖的package包/类
/**
 * Builds {@link Provider}s for the given {@link Document}s.
 * @param docsResult the {@link Document}s to convert.
 * @return a new {@link ISearchResult} containing the {@link Provider}s and the
 * 			totalHits from the given {@link DocumentsSearchResult}.
 */
private ISearchResult<Provider> docsToProviders(final DocumentsSearchResult docsResult) {
	final List<Provider> providers = new ArrayList<>();

	for (final Document doc : docsResult.getResults()) {
		final String providerId = doc.get(IIndexElement.FIELD_ID);
		if(NumberUtils.isNumber(providerId)) {
			providers.add(getProvider(Integer.parseInt(providerId)));
		}
		else {
			LOGGER.error("Not numeric user id from index {}.", providerId);
		}
	}

	return new SimpleSearchResult<>(providers, docsResult.getTotalHits());
}
 
开发者ID:XMBomb,项目名称:InComb,代码行数:22,代码来源:ProviderDao.java

示例3: parseIntArray

import org.apache.commons.lang3.math.NumberUtils; //导入方法依赖的package包/类
/**
 * Parses a string, representing an array of integers (e.g. [1,2,3]) into an {@link Integer} array
 * @param arrayString an integer array string
 * @return an {@link Integer} array
 */
public static Integer[] parseIntArray(String arrayString) {
    String[] items = arrayString.replaceAll("\\[", "").replaceAll("\\]", "").split(",");

    Integer[] results = new Integer[items.length];

    for (int i = 0; i < items.length; i++) {
        String numberString = items[i].trim();
        if (NumberUtils.isNumber(numberString)) {
            results[i] = Integer.parseInt(numberString);
        } else {
            return null;
        }
    }

    return results;
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:22,代码来源:Utils.java

示例4: validate

import org.apache.commons.lang3.math.NumberUtils; //导入方法依赖的package包/类
@Override
public ArrayList<String> validate() {
	ArrayList<String> ret = new ArrayList<>();
	if (name == null || name.equalsIgnoreCase("null") || name.trim().length() == 0)
		ret.add("Operation Name Cannot be empty");
	if (type == null || type.equalsIgnoreCase("null") || type.trim().length() == 0)
		ret.add("Operation Type Cannot be empty");
	if (getType().equalsIgnoreCase(Enums.ModuleOperationTypes.REQUEST_SENT.name())) {
		if (timeout == null || timeout.equalsIgnoreCase("null") || timeout.trim().length() == 0 || !NumberUtils.isNumber(timeout))
			ret.add("Timeout Cannot be empty");
	}
	if (getType().equalsIgnoreCase(Enums.ModuleOperationTypes.DATA_READ.name()) || getType().equalsIgnoreCase(Enums.ModuleOperationTypes.DATA_WRITE.name())) {
		if (dType == null || dType.equalsIgnoreCase("null") || dType.trim().length() == 0)
			ret.add("Data Type Cannot be empty");
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:18,代码来源:ModuleOperationNode.java

示例5: validate

import org.apache.commons.lang3.math.NumberUtils; //导入方法依赖的package包/类
@Override
public ArrayList<String> validate() {
	ArrayList<String> ret = new ArrayList<>();
	if (name == null || name.equalsIgnoreCase("null") || name.trim().length() == 0)
		ret.add("Node Name Cannot be empty");
	if (endianess == null || endianess.equalsIgnoreCase("null") || endianess.trim().length() == 0)
		ret.add("Endianess Cannot be empty");
	if (osName == null || osName.equalsIgnoreCase("null") || osName.trim().length() == 0)
		ret.add("OS Name Cannot be empty");
	if (osVer == null || osVer.equalsIgnoreCase("null") || osVer.trim().length() == 0)
		ret.add("OS Version Cannot be empty");
	if (availMem == null || availMem.equalsIgnoreCase("null") || availMem.trim().length() == 0 || (!NumberUtils.isNumber(availMem)))
		ret.add("Available Memory Cannot be empty or a Non-numeric value");
	if (mst == null || mst.equalsIgnoreCase("null") || mst.trim().length() == 0 || (!NumberUtils.isNumber(mst)))
		ret.add("Module Switch Time Cannot be empty or a Non-numeric value");
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:18,代码来源:LogicalComputingNode.java

示例6: getBigFileThreshold

import org.apache.commons.lang3.math.NumberUtils; //导入方法依赖的package包/类
public static final Long getBigFileThreshold() {
  if (bigFileThreshold == null) {
    String bigThresholdValue = configure.get("filecloud.bigfile-threshold");
    if (StringUtils.isNotBlank(bigThresholdValue) && NumberUtils.isNumber(bigThresholdValue.trim())) {
      bigFileThreshold = NumberUtils.toLong(bigThresholdValue.trim());
    } else {
      bigFileThreshold = DEFAULT_BIG_FILE_THRESHOLD;
    }
  }
  return bigFileThreshold;
}
 
开发者ID:devpage,项目名称:fastdfs-quickstart,代码行数:12,代码来源:Constants.java

示例7: parseAndSetScore

import org.apache.commons.lang3.math.NumberUtils; //导入方法依赖的package包/类
private void parseAndSetScore(String[] tokens, int tokenCount, NggbSimpleBedFeature feature) {
    if (tokenCount > SCORE_OFFSET && NumberUtils.isNumber(tokens[SCORE_OFFSET])) {
        try {
            float score = Float.parseFloat(tokens[SCORE_OFFSET]);
            feature.setScore(score);
        } catch (NumberFormatException numberFormatException) {
            feature.setScore(Float.NaN);
        }
    }
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:11,代码来源:NggbBedCodec.java

示例8: parseAndSetColour

import org.apache.commons.lang3.math.NumberUtils; //导入方法依赖的package包/类
private void parseAndSetColour(String[] tokens, int tokenCount, NggbSimpleBedFeature feature) {
    if (tokenCount > COLOUR_OFFSET) {
        String colorString = tokens[COLOUR_OFFSET];
        feature.setColor(ParsingUtils.parseColor(colorString));
        // ThickStart and ThickEnd
        if (NumberUtils.isNumber(tokens[THICK_START_OFFSET])
                && NumberUtils.isNumber(tokens[THICK_END_OFFSET])) {
            feature.setThickStart(Integer.parseInt(tokens[THICK_START_OFFSET]));
            feature.setThickEnd(Integer.parseInt(tokens[THICK_END_OFFSET]));
        }
    }
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:13,代码来源:NggbBedCodec.java

示例9: editInput

import org.apache.commons.lang3.math.NumberUtils; //导入方法依赖的package包/类
@RequestMapping("/edit.html")
public String editInput(String id, ModelMap model) {
    PayChannel item = null;
    if(StringUtils.isNotBlank(id) && NumberUtils.isNumber(id)) {
        item = payChannelService.selectPayChannel(Integer.parseInt(id));
    }
    if(item == null) item = new PayChannel();
    model.put("item", item);
    return "pay_channel/edit";
}
 
开发者ID:ywtnhm,项目名称:pay-xxpay-master,代码行数:11,代码来源:PayChannelController.java

示例10: viewInput

import org.apache.commons.lang3.math.NumberUtils; //导入方法依赖的package包/类
@RequestMapping("/view.html")
public String viewInput(String id, ModelMap model) {
    PayChannel item = null;
    if(StringUtils.isNotBlank(id) && NumberUtils.isNumber(id)) {
        item = payChannelService.selectPayChannel(Integer.parseInt(id));
    }
    if(item == null) item = new PayChannel();
    model.put("item", item);
    return "pay_channel/view";
}
 
开发者ID:ywtnhm,项目名称:pay-xxpay-master,代码行数:11,代码来源:PayChannelController.java

示例11: getMaxRetryUploadFastDFSTimes

import org.apache.commons.lang3.math.NumberUtils; //导入方法依赖的package包/类
public static final Integer getMaxRetryUploadFastDFSTimes() {
  if (maxRetryUploadFastDFSTimes == null) {
    String maxRetryUploadFastDFSTimesValue = configure.get("filecloud.fdfs-max-retry-times");
    if (StringUtils.isNotBlank(maxRetryUploadFastDFSTimesValue) && NumberUtils.isNumber(maxRetryUploadFastDFSTimesValue.trim())) {
      maxRetryUploadFastDFSTimes = NumberUtils.toInt(maxRetryUploadFastDFSTimesValue.trim());
    } else {
      maxRetryUploadFastDFSTimes = DEFAULT_MAX_RETRY_UPLOAD_TIMES;
    }
  }
  return maxRetryUploadFastDFSTimes;
}
 
开发者ID:devpage,项目名称:fastdfs-quickstart,代码行数:12,代码来源:Constants.java

示例12: validate

import org.apache.commons.lang3.math.NumberUtils; //导入方法依赖的package包/类
@Override
public ArrayList<String> validate() {
	ArrayList<String> ret = new ArrayList<>();
	if (name == null || name.equalsIgnoreCase("null") || name.trim().length() == 0)
		ret.add("Dynamic Trigger Instance Name Cannot be empty");
	if (priority == null || priority.equalsIgnoreCase("null") || priority.trim().length() == 0 || (!NumberUtils.isNumber(priority)))
		ret.add("Dynamic Trigger Instance Priority Cannot be empty or a non numeric value");
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:10,代码来源:DynamicTriggerInstanceNode.java

示例13: addNumberInfo

import org.apache.commons.lang3.math.NumberUtils; //导入方法依赖的package包/类
private void addNumberInfo(Map<String, Object> permittedInfo, Map<String, Object> info, int count,
                           VCFHeaderLineType type, InfoItem key) {
    Object value;
    if (count > 1) {
        value = parseNumberArray(type, info.get(key.getName()));

        if (value == null) {
            LOGGER.error(MessageHelper.getMessage(
                MessagesConstants.ERROR_FEATURE_INDEX_WRITING_WRONG_PARAMETER_TYPE,
                key.getName(), key.getType(), info.get(key.getName()).toString()));
            return;
        }

        permittedInfo.put("_" + key.getName() + "_v", info.get(key.getName()).toString());
    } else {
        String numberString = info.get(key.getName()).toString();

        if (NumberUtils.isNumber(numberString)) {
            value = parseNumber(type, info.get(key.getName()));
        } else {
            LOGGER.error(MessageHelper.getMessage(
                MessagesConstants.ERROR_FEATURE_INDEX_WRITING_WRONG_PARAMETER_TYPE, key.getName(), key.getType(),
                numberString));
            return;
        }
    }

    permittedInfo.put(key.getName(), value);
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:30,代码来源:FeatureIndexManager.java

示例14: validate

import org.apache.commons.lang3.math.NumberUtils; //导入方法依赖的package包/类
@Override
public ArrayList<String> validate() {
	ArrayList<String> ret = new ArrayList<>();
	if (compName == null || compName.equalsIgnoreCase("null") || compName.trim().length() == 0)
		ret.add("Computing Platform Name Cannot be empty");
	if (moduleName == null || moduleName.equalsIgnoreCase("null") || moduleName.trim().length() == 0)
		ret.add("Module Instance Name Cannot be empty");
	if (priority == null || priority.equalsIgnoreCase("null") || priority.trim().length() == 0 || (!NumberUtils.isNumber(priority)))
		ret.add("Priority Cannot be empty or a Non-numeric value");
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:12,代码来源:DeployedModuleInstanceNode.java

示例15: validate

import org.apache.commons.lang3.math.NumberUtils; //导入方法依赖的package包/类
@Override
public ArrayList<String> validate() {
	ArrayList<String> ret = new ArrayList<>();
	if (compPlatform == null || compPlatform.equalsIgnoreCase("null") || compPlatform.trim().length() == 0)
		ret.add("Computing Platform Name Cannot be empty");
	if (mcastAddr == null || mcastAddr.equalsIgnoreCase("null") || mcastAddr.trim().length() == 0)
		ret.add("Multicast Address Cannot be empty");
	if (notifMaxNumber == null || notifMaxNumber.equalsIgnoreCase("null") || notifMaxNumber.trim().length() == 0 || (!NumberUtils.isNumber(notifMaxNumber)))
		ret.add("Notification Max Number Cannot be empty or a Non-numeric value");
	if (port == null || port.equalsIgnoreCase("null") || port.trim().length() == 0 || (!NumberUtils.isNumber(port)))
		ret.add("Port Number Cannot be empty or a Non-numeric value");
	if (platNum == null || platNum.equalsIgnoreCase("null") || platNum.trim().length() == 0 || (!NumberUtils.isNumber(platNum)))
		ret.add("Platform Number Cannot be empty or a Non-numeric value");
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:16,代码来源:PlatformConfigurationNode.java


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