本文整理匯總了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());
}