Package com.blackbuild.klum.ast
Annotation Interface Role
Designates this field as a role field. A role is the name of the field of the owner, where this object is referenced.
@DSL
class Database {
@Role User ddl
@Role User dml
@Role User monitoring
}
@DSL
class User {
@Key String name
@Owner Database database
@Role String role
}
when:
instance = Database.Create.With {
ddl("user1")
dml("user2")
monitoring("user3")
}
then:
instance.ddl.role == "ddl"
instance.dml.role == "dml"
instance.monitoring.role == "monitoring"
Note that while it is technically valid to use Role without a matching Owner field, the role
will always be null, so this usually only makes sense in special, inheritance related cases.
-
Optional Element Summary
Optional Elements
-
Element Details
-
value
Class<?> valueif set, role will only be set if the owner instance is of this type- Default:
- java.lang.Object.class
-