设计模式:UML图

2020-05-07  本文已影响0人  Teemo_fca4

UML是一套符号的规定,这些符号用于描述软件个元素之间的关系,如类之间的关系,依赖,泛化(继承),实现,关联,组合,聚合等。

image.png
public class PersonServiceBean {
    private PersonDao personDao;// 类

    public void save(Person person) {
    }

    public IDCard getIDCard(Integer personid) {
        return null;
    }

    public void modify() {
        Department department = new Department();
    }
}

public class Department {

}
public class IDCard {

}
public class Person {

}
public class PersonDao {

}

其uml图如下:


image.png
public abstract class DaoSupport{
    public void save(Object entity){
    }
    public void delete(Object id){
    }
}
public class PersonServiceBean extends DaoSupport {

}
image.png
public interface PersonService {
    public void delete(Integer id);
}
public class PersonServiceBean implements PersonService{

    @Override
    public void delete(Integer id) {
        System.out.println("delete..");
    }
}
image.png
public class Person {
    private IDCard card; //聚合关系
    private Head head = new Head(); //组合关系

}

class IDCard {

}
class Head {
    
}
image.png
上一篇下一篇

猜你喜欢

热点阅读