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


Java BooleanUtils.toInteger方法代码示例

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


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

示例1: saveOrUpdate

import org.apache.commons.lang3.BooleanUtils; //导入方法依赖的package包/类
/**
 * Save or update the given entity from the {@link QuoteInstanceEditionVo}. The
 * computed cost are recursively updated from the instance to the quote total
 * cost.
 */
private UpdatedCost saveOrUpdate(final ProvQuoteInstance entity, final QuoteInstanceEditionVo vo) {
	// Compute the unbound cost delta
	final int deltaUnbound = BooleanUtils.toInteger(vo.getMaxQuantity() == null) - BooleanUtils.toInteger(entity.isUnboundCost());

	// Check the associations and copy attributes to the entity
	final ProvQuote configuration = getQuoteFromSubscription(vo.getSubscription());
	entity.setConfiguration(configuration);
	final Subscription subscription = configuration.getSubscription();
	final String providerId = subscription.getNode().getRefined().getId();
	DescribedBean.copy(vo, entity);
	entity.setPrice(ipRepository.findOneExpected(vo.getPrice()));
	entity.setLocation(resource.findLocation(subscription.getId(), vo.getLocation()));
	entity.setUsage(Optional.ofNullable(vo.getUsage()).map(u -> resource.findConfigured(usageRepository, u)).orElse(null));
	entity.setOs(ObjectUtils.defaultIfNull(vo.getOs(), entity.getPrice().getOs()));
	entity.setRam(vo.getRam());
	entity.setCpu(vo.getCpu());
	entity.setConstant(vo.getConstant());
	entity.setEphemeral(vo.isEphemeral());
	entity.setInternet(vo.getInternet());
	entity.setMaxVariableCost(vo.getMaxVariableCost());
	entity.setMinQuantity(vo.getMinQuantity());
	entity.setMaxQuantity(vo.getMaxQuantity());

	resource.checkVisibility(entity.getPrice().getType(), providerId);
	checkConstraints(entity);
	checkOs(entity);

	// Update the unbound increment of the global quote
	configuration.setUnboundCostCounter(configuration.getUnboundCostCounter() + deltaUnbound);

	// Save and update the costs
	final UpdatedCost cost = newUpdateCost(entity);
	final Map<Integer, FloatingCost> storagesCosts = new HashMap<>();
	CollectionUtils.emptyIfNull(entity.getStorages())
			.forEach(s -> storagesCosts.put(s.getId(), addCost(s, storageResource::updateCost)));
	cost.setRelatedCosts(storagesCosts);
	cost.setTotalCost(toFloatingCost(entity.getConfiguration()));
	return cost;
}
 
开发者ID:ligoj,项目名称:plugin-prov,代码行数:45,代码来源:ProvQuoteInstanceResource.java

示例2: sessionCount

import org.apache.commons.lang3.BooleanUtils; //导入方法依赖的package包/类
@Override
public int sessionCount() {
    return BooleanUtils.toInteger(this.supportRegistryState, this.ticketGrantingTicketsCache
            .getKeysWithExpiryCheck().size(), super.sessionCount());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:6,代码来源:EhCacheTicketRegistry.java

示例3: serviceTicketCount

import org.apache.commons.lang3.BooleanUtils; //导入方法依赖的package包/类
@Override
public int serviceTicketCount() {
    return BooleanUtils.toInteger(this.supportRegistryState, this.serviceTicketsCache.getKeysWithExpiryCheck()
            .size(), super.serviceTicketCount());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:6,代码来源:EhCacheTicketRegistry.java

示例4: sessionCount

import org.apache.commons.lang3.BooleanUtils; //导入方法依赖的package包/类
@Override
public int sessionCount() {
    return BooleanUtils.toInteger(this.supportRegistryState, this.ticketGrantingTicketsCache
        .size(CachePeekMode.ALL), super.sessionCount());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:6,代码来源:IgniteTicketRegistry.java

示例5: serviceTicketCount

import org.apache.commons.lang3.BooleanUtils; //导入方法依赖的package包/类
@Override
public int serviceTicketCount() {
    return BooleanUtils.toInteger(this.supportRegistryState, this.serviceTicketsCache
        .size(CachePeekMode.ALL), super.serviceTicketCount());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:6,代码来源:IgniteTicketRegistry.java

示例6: sessionCount

import org.apache.commons.lang3.BooleanUtils; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 * @see Cache#getKeysWithExpiryCheck()
 */
@Override
public int sessionCount() {
    return BooleanUtils.toInteger(this.supportRegistryState, this.ticketGrantingTicketsCache
            .getKeysWithExpiryCheck().size(), super.sessionCount());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:10,代码来源:EhCacheTicketRegistry.java

示例7: serviceTicketCount

import org.apache.commons.lang3.BooleanUtils; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 * @see Cache#getKeysWithExpiryCheck()
 */
@Override
public int serviceTicketCount() {
    return BooleanUtils.toInteger(this.supportRegistryState, this.serviceTicketsCache.getKeysWithExpiryCheck()
            .size(), super.serviceTicketCount());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:10,代码来源:EhCacheTicketRegistry.java


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