本文整理了Java中org.springframework.util.Assert.instanceCheckFailed()
方法的一些代码示例,展示了Assert.instanceCheckFailed()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.instanceCheckFailed()
方法的具体详情如下:
包路径:org.springframework.util.Assert
类名称:Assert
方法名:instanceCheckFailed
暂无
代码示例来源:origin: spring-projects/spring-framework
/**
* Assert that the provided object is an instance of the provided class.
* <pre class="code">Assert.instanceOf(Foo.class, foo, "Foo expected");</pre>
* @param type the type to check against
* @param obj the object to check
* @param message a message which will be prepended to provide further context.
* If it is empty or ends in ":" or ";" or "," or ".", a full exception message
* will be appended. If it ends in a space, the name of the offending object's
* type will be appended. In any other case, a ":" with a space and the name
* of the offending object's type will be appended.
* @throws IllegalArgumentException if the object is not an instance of type
*/
public static void isInstanceOf(Class<?> type, @Nullable Object obj, String message) {
notNull(type, "Type to check against must not be null");
if (!type.isInstance(obj)) {
instanceCheckFailed(type, obj, message);
}
}
代码示例来源:origin: spring-projects/spring-framework
/**
* Assert that the provided object is an instance of the provided class.
* <pre class="code">
* Assert.instanceOf(Foo.class, foo, () -> "Processing " + Foo.class.getSimpleName() + ":");
* </pre>
* @param type the type to check against
* @param obj the object to check
* @param messageSupplier a supplier for the exception message to use if the
* assertion fails. See {@link #isInstanceOf(Class, Object, String)} for details.
* @throws IllegalArgumentException if the object is not an instance of type
* @since 5.0
*/
public static void isInstanceOf(Class<?> type, @Nullable Object obj, Supplier<String> messageSupplier) {
notNull(type, "Type to check against must not be null");
if (!type.isInstance(obj)) {
instanceCheckFailed(type, obj, nullSafeGet(messageSupplier));
}
}
代码示例来源:origin: org.springframework/spring-core
/**
* Assert that the provided object is an instance of the provided class.
* <pre class="code">Assert.instanceOf(Foo.class, foo, "Foo expected");</pre>
* @param type the type to check against
* @param obj the object to check
* @param message a message which will be prepended to provide further context.
* If it is empty or ends in ":" or ";" or "," or ".", a full exception message
* will be appended. If it ends in a space, the name of the offending object's
* type will be appended. In any other case, a ":" with a space and the name
* of the offending object's type will be appended.
* @throws IllegalArgumentException if the object is not an instance of type
*/
public static void isInstanceOf(Class<?> type, @Nullable Object obj, String message) {
notNull(type, "Type to check against must not be null");
if (!type.isInstance(obj)) {
instanceCheckFailed(type, obj, message);
}
}
代码示例来源:origin: org.springframework/spring-core
/**
* Assert that the provided object is an instance of the provided class.
* <pre class="code">
* Assert.instanceOf(Foo.class, foo, () -> "Processing " + Foo.class.getSimpleName() + ":");
* </pre>
* @param type the type to check against
* @param obj the object to check
* @param messageSupplier a supplier for the exception message to use if the
* assertion fails. See {@link #isInstanceOf(Class, Object, String)} for details.
* @throws IllegalArgumentException if the object is not an instance of type
* @since 5.0
*/
public static void isInstanceOf(Class<?> type, @Nullable Object obj, Supplier<String> messageSupplier) {
notNull(type, "Type to check against must not be null");
if (!type.isInstance(obj)) {
instanceCheckFailed(type, obj, nullSafeGet(messageSupplier));
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core
/**
* Assert that the provided object is an instance of the provided class.
* <pre class="code">Assert.instanceOf(Foo.class, foo, "Foo expected");</pre>
* @param type the type to check against
* @param obj the object to check
* @param message a message which will be prepended to provide further context.
* If it is empty or ends in ":" or ";" or "," or ".", a full exception message
* will be appended. If it ends in a space, the name of the offending object's
* type will be appended. In any other case, a ":" with a space and the name
* of the offending object's type will be appended.
* @throws IllegalArgumentException if the object is not an instance of type
*/
public static void isInstanceOf(Class<?> type, @Nullable Object obj, String message) {
notNull(type, "Type to check against must not be null");
if (!type.isInstance(obj)) {
instanceCheckFailed(type, obj, message);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core
/**
* Assert that the provided object is an instance of the provided class.
* <pre class="code">
* Assert.instanceOf(Foo.class, foo, () -> "Processing " + Foo.class.getSimpleName() + ":");
* </pre>
* @param type the type to check against
* @param obj the object to check
* @param messageSupplier a supplier for the exception message to use if the
* assertion fails. See {@link #isInstanceOf(Class, Object, String)} for details.
* @throws IllegalArgumentException if the object is not an instance of type
* @since 5.0
*/
public static void isInstanceOf(Class<?> type, @Nullable Object obj, Supplier<String> messageSupplier) {
notNull(type, "Type to check against must not be null");
if (!type.isInstance(obj)) {
instanceCheckFailed(type, obj, nullSafeGet(messageSupplier));
}
}
代码示例来源:origin: apache/servicemix-bundles
notNull(type, "Type to check against must not be null");
if (!type.isInstance(obj)) {
instanceCheckFailed(type, obj, message);
notNull(type, "Type to check against must not be null");
if (!type.isInstance(obj)) {
instanceCheckFailed(type, obj, nullSafeGet(messageSupplier));
内容来源于网络,如有侵权,请联系作者删除!