Map<String, PropertySymbol> reverseMapping = Maps.create();
for (MappingFactor mapping : term.getMappings()) {
reverseMapping.put(mapping.getTarget().getName().identifier, mapping.getSource());
}
for (PropertySymbol property : term.getGrouping()) {
PropertySymbol origin = reverseMapping.get(property.getName().identifier);
assert origin != null;
PropertyDeclaration decl = origin.findDeclaration();
properties.add(Models.toLiteral(f, context.getFieldName(decl).getToken()));
}
return new AttributeBuilder(f)
.annotation(context.resolve(Key.class),
"group", f.newArrayInitializer(properties)) //$NON-NLS-1$