Closed dotWee closed 9 years ago
There's an example in the javadoc for @Implements
. I've been meaning to add one to the wiki, just haven't gotten around to it yet. For implementing Comparable though:
@TableModelSpec(className = "Person", tableName = "people")
@Implements(interfaceDefinitions = {
@Implements.InterfaceSpec(interfaceClass=Comparable.class,
interfaceTypeArgNames="com.mypackage.Person")})
// This should generate class Person implements Comparable<Person>
public class PersonSpec {
...
@ModelMethod // For implementing the interface method
public static int compareTo(Person instance, Person other) {
// Implement the comparison here
}
}
Hope that helps!
That helps a lot! Thank you very much!
Sure thing! Maybe I'll just use that example for the wiki, it's a good one :)
Is there any example available for the new @Implement annotation? I'm searching for a way to implement a custom comparator into model specs.