当前位置: 首页>>代码示例>>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;未经允许,请勿转载。