private Property toProperty(EntityType entityType, String name, TypeMirror type,
Annotations annotations) {
Type propertyType = typeFactory.getType(type, true);
if (annotations.isAnnotationPresent(QueryType.class)) {
PropertyType propertyTypeAnn = annotations.getAnnotation(QueryType.class).value();
if (propertyTypeAnn != PropertyType.NONE) {
TypeCategory typeCategory = TypeCategory.valueOf(annotations.getAnnotation(QueryType.class).value().name());
if (typeCategory == null) {
return null;
}
propertyType = propertyType.as(typeCategory);
} else {
return null;
}
}
List<String> inits = Collections.emptyList();
if (annotations.isAnnotationPresent(QueryInit.class)) {
inits = ImmutableList.copyOf(annotations.getAnnotation(QueryInit.class).value());
}
return new Property(entityType, name, propertyType, inits);
}