Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DS] Use simple class name for single-element property annotations #1258

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1328,8 +1328,9 @@ private void processComponent(IDSModel model, TypeDeclaration type, ITypeBinding

private void collectComponentPropertyTypes(IDSDocumentFactory dsFactory,
LinkedHashMap<String, IDSProperty> newPropMap, Annotation propertyType) {
String fqdn = propertyType.getTypeName().getFullyQualifiedName();
ITypeBinding propertyTypeBinding = propertyType.resolveTypeBinding();
String simpleName = propertyTypeBinding.getName();

String prefix = getPrefix(propertyTypeBinding);
IMethodBinding[] methods = propertyTypeBinding.getDeclaredMethods();
Map<String, IDSProperty> map = Arrays.stream(methods)
Expand All @@ -1347,7 +1348,7 @@ private void collectComponentPropertyTypes(IDSDocumentFactory dsFactory,
}
if (propertyType instanceof MarkerAnnotation && map.isEmpty()) {
IDSProperty property = dsFactory.createProperty();
property.setPropertyName(NameGenerator.createClassPropertyName(fqdn, prefix));
property.setPropertyName(NameGenerator.createClassPropertyName(simpleName, prefix));
property.setPropertyType(IDSConstants.VALUE_PROPERTY_TYPE_BOOLEAN);
property.setPropertyValue(String.valueOf(Boolean.TRUE));
newPropMap.remove(property.getName()); // force re-insert (append)
Expand All @@ -1356,7 +1357,7 @@ private void collectComponentPropertyTypes(IDSDocumentFactory dsFactory,
}
if (propertyType instanceof SingleMemberAnnotation single && map.size() == 1) {
IDSProperty property = dsFactory.createProperty();
property.setPropertyName(NameGenerator.createClassPropertyName(fqdn, prefix));
property.setPropertyName(NameGenerator.createClassPropertyName(simpleName, prefix));
Expression expression = single.getValue();
property.setPropertyType(getPropertyType(expression.resolveTypeBinding()));
setPropertyValue(property, expression);
Expand Down
Loading