WEB开发网
开发学院软件开发Java 面向 Java 开发人员的 db4o 指南: 结构化对象和集... 阅读

面向 Java 开发人员的 db4o 指南: 结构化对象和集合

 2010-04-01 00:00:00 来源:WEB开发网   
核心提示: db4o 中的继承(以及多态)其实就是这么简单,没有用于查询语言的复杂的 IS 扩展,面向 Java 开发人员的 db4o 指南: 结构化对象和集合(5),就不会引入不同于 Java 类型系统中现有概念的 “类型” 概念,我所指的只是期望作为查询的一部分的类型,方法就是选

db4o 中的继承(以及多态)其实就是这么简单。没有用于查询语言的复杂的 IS 扩展,就不会引入不同于 Java 类型系统中现有概念的 “类型” 概念。我所指的只是期望作为查询的一部分的类型,而且这些是构成查询的主要成分。这跟在 SQL 查询中加入表格很相似,方法就是选择其数据应为查询结果一部分的表格。额外的好处是,“父类型” 也是作为查询的一部分隐式地 “加入” 的。清单 6 显示了 清单 3 中 InheritanceTest 的输出:

清单 6. 多态发挥作用

.Found [Employee: Ted Neward (President and CEO)] 
Found [Person: firstName = Charlotte lastName = Neward gender = FEMALE age = 35 
mood = HAPPY spouse = Ted ] 
Found [Person: firstName = Michael lastName = Neward gender = MALE age = 14 mood 
 = CRANKY ] 
Found [Person: firstName = Matthew lastName = Neward gender = MALE age = 8 mood 
= CRANKY ] 
Found [Employee: Bruce Tate (Chief Technical Officer)] 
Found [Person: firstName = Maggie lastName = Tate gender = FEMALE age = 29 mood 
= HAPPY spouse = Bruce ] 
Found [Person: firstName = Kayla lastName = Tate gender = FEMALE age = 0 mood = 
CRANKY ] 
Found [Person: firstName = Julia lastName = Tate gender = FEMALE age = 0 mood = 
CRANKY ] 
Found [Employee: Neal Ford (Meme Wrangler)] 
Found [Person: firstName = Candi lastName = Ford gender = FEMALE age = 29 mood = 
 HAPPY spouse = Neal ] 
Found [Employee: Brian Sletten (Bosatsu Master)] 
Found [Person: firstName = Kristen lastName = Sletten gender = FEMALE age = 29 m 
ood = HAPPY spouse = Brian ] 
Found [Employee: Ben Galbraith (Chief UI Director)] 
Found [Person: firstName = Jessica lastName = Galbraith gender = FEMALE age = 29 
 mood = HAPPY spouse = Ben ] 

上一页  1 2 3 4 5 6 7 8  下一页

Tags:面向 Java 开发

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接