use of com.yahoo.squidb.annotations.Alias in project squidb by yahoo.
the class ViewModelFileWriter method emitPropertyReferenceArrayBody.
private boolean emitPropertyReferenceArrayBody(boolean alias) throws IOException {
for (PropertyGenerator propertyGenerator : modelSpec.getPropertyGenerators()) {
Expression reference = Expressions.staticReference(modelSpec.getModelSpecName(), propertyGenerator.getPropertyName());
if (alias) {
VariableElement field = propertyGenerator.getField();
if (field != null) {
Alias aliasAnnotation = field.getAnnotation(Alias.class);
if (aliasAnnotation != null && !AptUtils.isEmpty(aliasAnnotation.value().trim())) {
reference = reference.callMethod("as", "\"" + aliasAnnotation.value().trim() + "\"");
}
}
}
writer.writeExpression(reference);
writer.appendString(",\n");
}
return !AptUtils.isEmpty(modelSpec.getPropertyGenerators());
}
Aggregations