Example code for EntityComposite in Scala. I usually separate between
command interface (suggestions to change), events (after the fact), and
data, so they are in three separate traits below. Only commands are
called by client code:
trait TestEntity
extends EntityComposite with Commands with Events with Data
trait Commands
{
self: Events =>
def updateFoo(newValue : String)
{
updatedFoo(newValue)
}
}
trait Events
{
self: Data =>
def updatedFoo(newValue : String)
{
foo().set(newValue)
}
}
trait Data
{
@UseDefaults
def foo(): Property[String]
}
---
The "self" operator thing pretty much solves the @This injection
requirements, although it doesn't do private injections yet (i.e. the
entity *has* to extend Events and Data for it to work.
Everything is statically typed. Nice start.
/Rickard
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev