public List<Annotation> getTypeAnnotations(EmitContext context, ModelDeclaration model) {
PrimaryKeyTrait trait = model.getTrait(PrimaryKeyTrait.class);
if (trait == null) {
return Collections.emptyList();
}
ModelFactory f = context.getModelFactory();
List<Expression> properties = Lists.create();
for (PropertySymbol property : trait.getProperties()) {
String name = context.getFieldName(property.findDeclaration()).getToken();
properties.add(Models.toLiteral(f, name));
}
return new AttributeBuilder(f)
.annotation(context.resolve(PrimaryKey.class),
"value", f.newArrayInitializer(properties))
.toAnnotations();
}