當前位置: 首頁>>代碼示例>>Java>>正文


Java BooleanUtils.toBooleanObject方法代碼示例

本文整理匯總了Java中org.apache.commons.lang3.BooleanUtils.toBooleanObject方法的典型用法代碼示例。如果您正苦於以下問題:Java BooleanUtils.toBooleanObject方法的具體用法?Java BooleanUtils.toBooleanObject怎麽用?Java BooleanUtils.toBooleanObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.lang3.BooleanUtils的用法示例。


在下文中一共展示了BooleanUtils.toBooleanObject方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: resolveModifier

import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
private void resolveModifier(
    final GenericAttributeValue<Boolean> attribute,
    final String methodName,
    final List<String> resultList
) {
    if (attribute == null) {
        return;
    }
    final Boolean value = BooleanUtils.toBooleanObject(attribute.getStringValue());
    if (value == null) {
        return;
    }
    if (value) {
        resultList.add(methodName);
    } else {
        resultList.add(methodName + "(false)");
    }

}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:20,代碼來源:TSStructureTreeElement.java

示例2: createBooleanExpression

import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
/**
 * Return an expression for {@code entityPath.fieldName} (for Booleans) with
 * the {@code operator} or "equal" by default.
 * <p/>
 * Expr: {@code entityPath.fieldName eq searchObj}
 * 
 * @param entityPath
 * @param fieldName
 * @param searchObj
 * @param operator
 * @return
 */
public static <T> BooleanExpression createBooleanExpression(
        PathBuilder<T> entityPath, String fieldName, Object searchObj,
        String operator) {
    Boolean value = BooleanUtils.toBooleanObject((String) searchObj);
    if (value != null) {
        if (StringUtils.equalsIgnoreCase(operator, OPERATOR_GOE)) {
            return entityPath.getBoolean(fieldName).goe(value);
        }
        else if (StringUtils.equalsIgnoreCase(operator, "gt")) {
            return entityPath.getBoolean(fieldName).gt(value);
        }
        else if (StringUtils.equalsIgnoreCase(operator, OPERATOR_LOE)) {
            return entityPath.getBoolean(fieldName).loe(value);
        }
        else if (StringUtils.equalsIgnoreCase(operator, "lt")) {
            return entityPath.getBoolean(fieldName).lt(value);
        }
    }
    return entityPath.get(fieldName).eq(searchObj);
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:33,代碼來源:QuerydslUtils.java

示例3: createBooleanExpression

import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public <T> BooleanExpression createBooleanExpression(
        PathBuilder<T> entityPath, String fieldName, Object searchObj,
        String operator) {
    Boolean value = BooleanUtils.toBooleanObject((String) searchObj);
    if (value != null) {
        if (StringUtils.equalsIgnoreCase(operator, OPERATOR_GOE)) {
            return entityPath.getBoolean(fieldName).goe(value);
        }
        else if (StringUtils.equalsIgnoreCase(operator, "gt")) {
            return entityPath.getBoolean(fieldName).gt(value);
        }
        else if (StringUtils.equalsIgnoreCase(operator, OPERATOR_LOE)) {
            return entityPath.getBoolean(fieldName).loe(value);
        }
        else if (StringUtils.equalsIgnoreCase(operator, "lt")) {
            return entityPath.getBoolean(fieldName).lt(value);
        }
    }
    return entityPath.get(fieldName).eq(searchObj);
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:25,代碼來源:QuerydslUtilsBeanImpl.java

示例4: call

import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
@Override
public Object call(Element element, List<SyntaxNode> params) {
    if (element == null) {
        return false;
    }
    Object ret = params.get(0).calc(element);
    if (ret == null) {
        return false;
    }

    if (ret instanceof Number) {
        int i = ((Number) ret).intValue();
        return XpathUtil.getElIndexInSameTags(element) == i;
    }

    if (ret instanceof Boolean) {
        return ret;
    }

    if (ret instanceof CharSequence) {
        String s = ret.toString();
        Boolean booleanValue = BooleanUtils.toBooleanObject(s);
        if (booleanValue != null) {
            return booleanValue;
        }
        return StringUtils.isNotBlank(s);
    }

    log.warn("can not recognize predicate expression calc result:" + ret);
    return false;
}
 
開發者ID:virjar,項目名稱:sipsoup,代碼行數:32,代碼來源:SipSoupPredicteJudgeFunction.java

示例5: convertKeys

import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
public Object convertKeys(String key) {
	if (BooleanUtils.toBooleanObject(key) != null) {
		return BooleanUtils.toBoolean(key);
	} else if (NumberUtils.isNumber(key) && (key.contains(",") || key.contains("."))) {
		return NumberUtils.toFloat(key);
	} else if (NumberUtils.isNumber(key)) {
		return NumberUtils.toInt(key);
	} else {
		return key;
	}
}
 
開發者ID:daflockinger,項目名稱:spongeblog,代碼行數:12,代碼來源:PaginationMapper.java

示例6: parseGeneralString

import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
/**
 * 支持true/false,on/off, y/n, yes/no的轉換, str為空或無法分析時返回null
 */
public static Boolean parseGeneralString(String str) {
	return BooleanUtils.toBooleanObject(str);
}
 
開發者ID:zhangjunfang,項目名稱:util,代碼行數:7,代碼來源:BooleanUtil.java

示例7: getBooleanProperty

import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
/**
 * Looks up the boolean property associated to the provided key. The following rules are used to determine
 * what is returned or if an error will be thrown.
 *
 * 1) If the key doesn't exist or the value associated to the key is not a valid boolean value (true/false, yes/no, on/off) and the provided default value is NULL then an error will be thrown
 * 2) Same as 1 but if the default value is not null then the default value will be returned
 * 3) Property key exists and is associated to a valid boolean value then it will be returned regardless of what default value is set to
 *
 * @param propertyKey
 * @param defaultVal
 * @return true or false depending on the rules listed above
 * @throws CandlestackPropertiesException
 *           if GlobalCandlestackProperties have not been initialized and if rule 1 applies
 */
public static boolean getBooleanProperty( String propertyKey, Boolean defaultVal ) throws CandlestackPropertiesException {
	initCheck();

	Boolean val = BooleanUtils.toBooleanObject( globalProps.getProperty( propertyKey ) );
	if ( val == null && defaultVal == null ) {
		throw new CandlestackPropertiesException( "GlobalCandlestackProperties was unable to locate valid boolean property for property key [" + propertyKey + "]" );
	} else if ( val == null ) {
		val = defaultVal;
	}

	return val.booleanValue();
}
 
開發者ID:CodeArcsInc,項目名稱:candlestack,代碼行數:27,代碼來源:GlobalCandlestackProperties.java


注:本文中的org.apache.commons.lang3.BooleanUtils.toBooleanObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。