本文整理汇总了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;
}
示例2: sessionCount
import org.apache.commons.lang3.BooleanUtils; //导入方法依赖的package包/类
@Override
public int sessionCount() {
return BooleanUtils.toInteger(this.supportRegistryState, this.ticketGrantingTicketsCache
.getKeysWithExpiryCheck().size(), super.sessionCount());
}
示例3: serviceTicketCount
import org.apache.commons.lang3.BooleanUtils; //导入方法依赖的package包/类
@Override
public int serviceTicketCount() {
return BooleanUtils.toInteger(this.supportRegistryState, this.serviceTicketsCache.getKeysWithExpiryCheck()
.size(), super.serviceTicketCount());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}