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


Java ClassUtils.isPrimitiveWrapper方法代碼示例

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


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

示例1: appendDetail

import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
@Override
public void appendDetail(final StringBuffer buffer, final String fieldName, final Object value) {
    if (!ClassUtils.isPrimitiveWrapper(value.getClass()) && !String.class.equals(value.getClass())
            && accept(value.getClass())) {
        spaces += INDENT;
        resetIndent();
        buffer.append(ReflectionToStringBuilder.toString(value, this));
        spaces -= INDENT;
        resetIndent();
    } else {
        super.appendDetail(buffer, fieldName, value);
    }
}
 
開發者ID:vietnguyen312,項目名稱:DebugLog,代碼行數:14,代碼來源:MultilineRecursiveToStringStyle.java

示例2: appendDetail

import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
@Override
public void appendDetail(final StringBuffer buffer, final String fieldName, final Object value) {
    if (!ClassUtils.isPrimitiveWrapper(value.getClass()) &&
            !String.class.equals(value.getClass()) &&
            accept(value.getClass())) {
        buffer.append(ReflectionToStringBuilder.toString(value, this));
    } else {
        super.appendDetail(buffer, fieldName, value);
    }
}
 
開發者ID:rogerxaic,項目名稱:gestock,代碼行數:11,代碼來源:RecursiveToStringStyle.java

示例3: appendDetail

import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
@Override
public void appendDetail(StringBuffer buffer, String fieldName, Object value) {
    if (!ClassUtils.isPrimitiveWrapper(value.getClass()) && !String.class.equals(value.getClass())
            && accept(value.getClass())) {
        spaces += indent;
        resetIndent();
        buffer.append(ReflectionToStringBuilder.toString(value, this));
        spaces -= indent;
        resetIndent();
    } else {
        super.appendDetail(buffer, fieldName, value);
    }
}
 
開發者ID:rogerxaic,項目名稱:gestock,代碼行數:14,代碼來源:MultilineRecursiveToStringStyle.java

示例4: appendDetail

import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
@Override
public void appendDetail(StringBuffer buffer, String fieldName, Object value) {
    if (!ClassUtils.isPrimitiveWrapper(value.getClass()) &&
        !String.class.equals(value.getClass()) &&
        accept(value.getClass())) {
        buffer.append(ReflectionToStringBuilder.toString(value, this));
    } else {
        super.appendDetail(buffer, fieldName, value);
    }
}
 
開發者ID:Sukelluskello,項目名稱:VectorAttackScanner,代碼行數:11,代碼來源:RecursiveToStringStyle.java

示例5: visitInspectorAssertion

import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
/**
 * <p>
 * visitInspectorAssertion
 * </p>
 * 
 * @param assertion
 *            a {@link org.evosuite.assertion.InspectorAssertion} object.
 */
protected void visitInspectorAssertion(InspectorAssertion assertion) {
	VariableReference source = assertion.getSource();
	Object value = assertion.getValue();
	Inspector inspector = assertion.getInspector();
	Class<?> generatedType = inspector.getReturnType();

	if (value == null) {
		testCode += "assertNull(" + getVariableName(source) + "."
		        + inspector.getMethodCall() + "());";
	} else if (value.getClass().equals(Long.class)) {
		testCode += "assertEquals(" + NumberFormatter.getNumberString(value, this) + ", ";
		if(ClassUtils.isPrimitiveWrapper(generatedType))
			testCode += "(long)";
		testCode +=  getVariableName(source) + "." + inspector.getMethodCall() + "());";
	} else if (value.getClass().equals(Short.class)) {
		testCode += "assertEquals(" + NumberFormatter.getNumberString(value, this) + ", ";
		if(ClassUtils.isPrimitiveWrapper(generatedType))
			testCode += "(short)";
		testCode +=  getVariableName(source) + "." + inspector.getMethodCall() + "());";
	} else if (value.getClass().equals(Integer.class)) {
		testCode += "assertEquals(" + NumberFormatter.getNumberString(value, this) + ", ";
		if(ClassUtils.isPrimitiveWrapper(generatedType))
			testCode += "(int)";
		testCode +=  getVariableName(source) + "." + inspector.getMethodCall() + "());";
	} else if (value.getClass().equals(Byte.class)) {
		testCode += "assertEquals(" + NumberFormatter.getNumberString(value, this) + ", ";
		if(ClassUtils.isPrimitiveWrapper(generatedType))
			testCode += "(byte)";
		testCode +=  getVariableName(source) + "." + inspector.getMethodCall() + "());";
	} else if (value.getClass().equals(Float.class)) {
		testCode += "assertEquals(" + NumberFormatter.getNumberString(value, this) + ", ";
		testCode += getVariableName(source) + "." + inspector.getMethodCall()
		        + "(), "+NumberFormatter.getNumberString(Properties.FLOAT_PRECISION, this)+");";
	} else if (value.getClass().equals(Double.class)) {
		testCode += "assertEquals(" + NumberFormatter.getNumberString(value, this) + ", ";
		testCode += getVariableName(source) + "." + inspector.getMethodCall()
		        + "(), "+NumberFormatter.getNumberString(Properties.DOUBLE_PRECISION, this)+");";
	} else if (value.getClass().equals(Character.class)) {
		testCode += "assertEquals(" + NumberFormatter.getNumberString(value, this) + ", ";
		if(ClassUtils.isPrimitiveWrapper(generatedType))
			testCode += "(char)";
		testCode += getVariableName(source) + "." + inspector.getMethodCall() + "());";
	} else if (value.getClass().equals(String.class)) {
		testCode += "assertEquals(" + NumberFormatter.getNumberString(value, this) + ", ";
		testCode += getVariableName(source) + "." + inspector.getMethodCall() + "());";
	} else if (value.getClass().isEnum() || value instanceof Enum) {
		testCode += "assertEquals(" + NumberFormatter.getNumberString(value, this) + ", "
		        + getVariableName(source) + "." + inspector.getMethodCall() + "());";
		// Make sure the enum is imported in the JUnit test			
		getClassName(value.getClass());

	} else if (value.getClass().equals(boolean.class) || value.getClass().equals(Boolean.class)) {
		if (((Boolean) value).booleanValue())
			testCode += "assertTrue(" + getVariableName(source) + "."
			        + inspector.getMethodCall() + "());";
		else
			testCode += "assertFalse(" + getVariableName(source) + "."
			        + inspector.getMethodCall() + "());";

	} else
		testCode += "assertEquals(" + value + ", " + getVariableName(source) + "."
		        + inspector.getMethodCall() + "());";
}
 
開發者ID:EvoSuite,項目名稱:evosuite,代碼行數:72,代碼來源:TestCodeVisitor.java

示例6: isInspectorMethod

import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
private boolean isInspectorMethod(Method method) {
	if (!Modifier.isPublic(method.getModifiers()))
		return false;

	if (!method.getReturnType().isPrimitive()
			&& !method.getReturnType().equals(String.class)
			&& !method.getReturnType().isEnum()
			&& !ClassUtils.isPrimitiveWrapper(method.getReturnType())) {
		return false;
	}

	if (method.getReturnType().equals(void.class))
		return false;

	if (method.getParameterTypes().length != 0)
		return false;

	if (method.getName().equals("hashCode"))
		return false;

	if (method.getDeclaringClass().equals(Object.class))
		return false;

	if (method.getDeclaringClass().equals(Enum.class))
		return false;

	if (method.isSynthetic())
		return false;

	if (method.isBridge())
		return false;

	if (method.getName().equals("pop"))
		return false;

	if (isBlackListed(method))
		return false;

	if (isImpureJDKMethod(method))
		return false;

	if(isAWTToString(method))
		return false;

	if (Properties.PURE_INSPECTORS) {
		if (!CheapPurityAnalyzer.getInstance().isPure(method)) {
			return false;
		}
	}

	return true;

}
 
開發者ID:EvoSuite,項目名稱:evosuite,代碼行數:54,代碼來源:InspectorManager.java

示例7: isPrimitive

import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
public static boolean isPrimitive(@NonNull final Tree type, @NonNull Set<ImportTree> imports) {
    Optional<Class<?>> clazz = classForName(type, imports);
    return clazz.isPresent() && ClassUtils.isPrimitiveWrapper(clazz.get());
}
 
開發者ID:mulesoft-labs,項目名稱:connector-certification-tools,代碼行數:5,代碼來源:ClassParserUtils.java

示例8: isPrimitive

import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
/**
 * 判斷指定類是否是基本類型
 * 這裏定義的基本類型包括以下幾種:
 * Boolean, Byte, Character, Short, Integer, Long, Double, Float, String
 * @param clazz 要判斷的類型
 * @return      true表示是基本類型
 */
public static boolean isPrimitive(Class<?> clazz) {
    return ClassUtils.isPrimitiveWrapper(clazz) || ClassUtils.isAssignable(clazz, String.class);
}
 
開發者ID:huhuics,項目名稱:tauren,代碼行數:11,代碼來源:ClassUtil.java


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