isAssignable

import java.util.HashMap;
import java.util.Map;

public class MapTest {

    public static void main(String[] args) {
        System.out.println(HashMap.class.isAssignableFrom(Map.class));
        System.out.println(Map.class.isAssignableFrom(HashMap.class));
    }

}

如上代码返回:

false

true

 

 

isAssignable方法的注释

Determines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter. 

从上面这行可以看出,如果与参数类型相同,或者是参数类型的父类,都返回true

转载于:https://www.cnblogs.com/shuada/p/6588071.html

Using VFS adapter com.baomidou.mybatisplus.autoconfigure.SpringBootVFS Checking to see if class com.lxyk.pojo.Account matches criteria [is assignable to Object] Checking to see if class com.lxyk.pojo.Customer matches criteria [is assignable to Object] Checking to see if class com.lxyk.pojo.History matches criteria [is assignable to Object] Checking to see if class com.lxyk.pojo.MainMenu matches criteria [is assignable to Object] Checking to see if class com.lxyk.pojo.Salary matches criteria [is assignable to Object] Checking to see if class com.lxyk.pojo.WaterDetails matches criteria [is assignable to Object] Checking to see if class com.lxyk.pojo.Worker matches criteria [is assignable to Object] Scanned package: 'com.lxyk.pojo' for aliases Warn: Could not find @TableId in Class: com.lxyk.pojo.Customer. Parsed mapper file: 'file [E:\Java_Pro\Project\basic-code\Springboot_Pro\target\classes\mapper\CustomerMapper.xml]' Warn: Could not find @TableId in Class: com.lxyk.pojo.History. Parsed mapper file: 'file [E:\Java_Pro\Project\basic-code\Springboot_Pro\target\classes\mapper\HistoryMapper.xml]' Warn: Could not find @TableId in Class: com.lxyk.pojo.Salary. Parsed mapper file: 'file [E:\Java_Pro\Project\basic-code\Springboot_Pro\target\classes\mapper\SalaryMapper.xml]' Warn: Could not find @TableId in Class: com.lxyk.pojo.WaterDetails. Parsed mapper file: 'file [E:\Java_Pro\Project\basic-code\Springboot_Pro\target\classes\mapper\WaterDetailsMapper.xml]' Warn: Could not find @TableId in Class: com.lxyk.pojo.Worker. Parsed mapper file: 'file [E:\Java_Pro\Project\basic-code\Springboot_Pro\target\classes\mapper\WorkerMapper.xml]' Warn: Could not find @TableId in Class: com.lxyk.pojo.Account.
05-25
SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/D:/develop/maven/apache-maven-3.3.9/repo/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/D:/project/gjyw/ibms/ibms-service/lib/pierce-sdk-1.0.0-with-jdk8.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder] Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationListener : org.springframework.boot.cloud.CloudFoundryVcapEnvironmentPostProcessor at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:439) at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:418) at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:409) at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:261) at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:240) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230) at com.sdhsie.ibms.Application.main(Application.java:14) Caused by: java.lang.IllegalArgumentException: class org.springframework.boot.cloud.CloudFoundryVcapEnvironmentPostProcessor is not assignable to interface org.springframework.context.ApplicationListener at org.springframework.util.Assert.assignableCheckFailed(Assert.java:655) at org.springframework.util.Assert.isAssignable(Assert.java:586) at org.springframework.util.Assert.isAssignable(Assert.java:617) at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:432) ... 7 more 如何解决
06-07
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值