Oct. 26, 2009
1:13 p.m.
2009/10/26 John Toohey <jt@parspro.com>:
Is is possible to apply a Trait to an object after it has been created? I have a situation where I have a collection of object that have been populated from a database, and depending on a typeId property, I would like to apply different Traits to that object. Each Trait would have the same method signatures, but the calculations performs by those methods would be different in each case.
It's not possible. A design pattern might better suit your needs. Have a look at State or Strategy. -- Damien Cassou http://damiencassou.seasidehosting.st "Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry