當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。