use of org.springframework.ide.vscode.commons.java.IJavaElement in project sts4 by spring-projects.
the class ApplicationYamlAssistContext method getAllJavaElements.
private static List<IJavaElement> getAllJavaElements(TypeUtil typeUtil, Type parentType, String propName) {
if (propName != null) {
Type beanType = parentType;
if (TypeUtil.isMap(beanType)) {
Type keyType = typeUtil.getKeyType(beanType);
if (keyType != null && typeUtil.isEnum(keyType)) {
IField field = typeUtil.getEnumConstant(keyType, propName);
if (field != null) {
return ImmutableList.of(field);
}
}
} else {
ArrayList<IJavaElement> elements = new ArrayList<IJavaElement>(3);
maybeAdd(elements, typeUtil.getField(beanType, propName));
maybeAdd(elements, typeUtil.getSetter(beanType, propName).get());
maybeAdd(elements, typeUtil.getGetter(beanType, propName));
if (!elements.isEmpty()) {
return elements;
}
}
}
return ImmutableList.of();
}
Aggregations