如果你用Java来开发代码,如果你用IntelliJ IDEA作为IDE工具开发,并且如果你用spring boot、maven等来构建你项目那么接下来,常用的三种视图会是你开发过程中常用到的。
一、层次结构视图
我们用工具IntelliJ IDEA,打开类Repository.class(org.springframework.data.repository),单击Navigate→Type Hierarchy
通过这个层次结构视图,我们就会明白基类Repository的实现,对工程里面的所有Repository了如指掌,我们项目里面有哪些、
Spring的项目里面有哪些也会一目了然。
二、图表的方式查看类的层次关系
通过IntelliJ IDEA打开类Example1里面的UserRepository.java,右击选择show diagrams,用图表的方式查看类的层次关系
package com.burns.ch1.repository;
import com.burns.ch1.entity.User;
import org.springframework.data.repository.CrudRepository;
public interface UserRepository extends CrudRepository<User,Long> {
}
三、查看Java类的结构以及有方法
通过IntelliJ IDEA打开类Example1里面的UserRepository.java,打开Navigate→File Structure 可以查看此类的结构以及有哪些方法。以此类推到其他类上