// Add getters and setters
for (final Entry<FieldMetadata, JavaSymbolName> entry : declaredFields
.entrySet()) {
final FieldMetadata field = entry.getKey();
final MethodMetadataBuilder accessorMethod = getDeclaredGetter(field);
final MethodMetadataBuilder mutatorMethod = getDeclaredSetter(field);
// Check to see if GAE is interested
if (entry.getValue() != null) {
JavaSymbolName hiddenIdFieldName;
if (field.getFieldType().isCommonCollectionType()) {
hiddenIdFieldName = governorTypeDetails
.getUniqueFieldName(field.getFieldName()
.getSymbolName() + "Keys");
builder.getImportRegistrationResolver().addImport(
GAE_DATASTORE_KEY_FACTORY);
builder.addField(getMultipleEntityIdField(hiddenIdFieldName));
} else {
hiddenIdFieldName = governorTypeDetails
.getUniqueFieldName(field.getFieldName()
.getSymbolName() + "Id");
builder.addField(getSingularEntityIdField(hiddenIdFieldName));
}
processGaeAnnotations(field);
accessorMethod.setBodyBuilder(getGaeAccessorBody(field,
hiddenIdFieldName));
mutatorMethod.setBodyBuilder(getGaeMutatorBody(field,
hiddenIdFieldName));
}
builder.addMethod(accessorMethod);
builder.addMethod(mutatorMethod);
}
// Implements interface methods if exists
if (interfaceMethods != null) {
for (MethodMetadata interfaceMethod : interfaceMethods) {
MethodMetadataBuilder methodBuilder = getInterfaceMethod(interfaceMethod);
builder.addMethod(methodBuilder);
}
}
// Create a representation of the desired output ITD