如何在电梯中做多态关系?

时间:2011-02-22 18:40:19

标签: scala lift

我是Lift和scala的新手并尝试做一些事情。 在我想要与电梯创建多态关联的那一刻 映射器。

这里有一个例子:

我想创建一个类Entry,它可以是任何一个n中的条目 ListX对象。我怎样才能让父母和条目成为现实 多态? 是否有通用的方法来与这些多态关联  OneToMany& ManyToMany在两个方向?

class Entry extends BaseModel[Entry] {
  def getSingleton = Entry

  object parent extends MappedBase(this, AnyList)

}

object Entry extends Entry with LongKeyedMetaMapper[Entry] {

}

class ListA extends BaseModel[ListA] with OneToMany[Long, ListA] {
  def getSingleton = ListA

  object entries extends MappedOneToMany(Entry, Entry.parent)

}

object ListA extends ListA with LongKeyedMetaMapper[ListA] {

}

class ListB extends BaseModel[ListB] with OneToMany[Long, ListB] {
  def getSingleton = ListB

  object entries extends MappedOneToMany(Entry, Entry.parent)

}

object ListB extends ListB with LongKeyedMetaMapper[ListB] {

}

class ListC extends BaseModel[ListC] with OneToMany[Long, ListC] {
  def getSingleton = ListC

  object entries extends MappedOneToMany(Entry, Entry.parent)

}

object ListC extends ListC with LongKeyedMetaMapper[ListC] {


} 

0 个答案:

没有答案