use of com.redhat.qute.commons.datamodel.resolvers.ValueResolverInfo in project quarkus-ls by redhat-developer.
the class MockQuteProject method createValueResolver.
protected static ValueResolverInfo createValueResolver(String namespace, String named, String matchName, String sourceType, String signature) {
ValueResolverInfo resolver = new ValueResolverInfo();
resolver.setNamespace(namespace);
resolver.setNamed(named);
resolver.setMatchName(matchName);
resolver.setSourceType(sourceType);
resolver.setSignature(signature);
return resolver;
}
use of com.redhat.qute.commons.datamodel.resolvers.ValueResolverInfo in project quarkus-ls by redhat-developer.
the class TemplateExtensionSupport method collectResolversForTemplateExtension.
private static void collectResolversForTemplateExtension(IMethod method, IAnnotation templateExtension, List<ValueResolverInfo> resolvers, ITypeResolver typeResolver) {
ValueResolverInfo resolver = new ValueResolverInfo();
resolver.setSourceType(method.getDeclaringType().getFullyQualifiedName());
resolver.setSignature(typeResolver.resolveMethodSignature(method));
try {
String namespace = AnnotationUtils.getAnnotationMemberValue(templateExtension, TEMPLATE_EXTENSION_ANNOTATION_NAMESPACE);
String matchName = AnnotationUtils.getAnnotationMemberValue(templateExtension, TEMPLATE_EXTENSION_ANNOTATION_MATCH_NAME);
resolver.setNamespace(namespace);
if (StringUtils.isNotEmpty(matchName)) {
resolver.setMatchName(matchName);
}
} catch (JavaModelException e) {
LOGGER.log(Level.SEVERE, "Error while getting annotation member value of '" + method.getElementName() + "'.", e);
}
if (!resolvers.contains(resolver)) {
resolvers.add(resolver);
}
}
use of com.redhat.qute.commons.datamodel.resolvers.ValueResolverInfo in project quarkus-ls by redhat-developer.
the class InjectNamespaceResolverSupport method collectResolversForInject.
private static void collectResolversForInject(IType type, String named, List<ValueResolverInfo> resolvers) {
ValueResolverInfo resolver = new ValueResolverInfo();
resolver.setNamed(named);
resolver.setSourceType(type.getFullyQualifiedName());
resolver.setSignature(type.getFullyQualifiedName());
resolver.setNamespace(INJECT_NAMESPACE);
resolvers.add(resolver);
}
use of com.redhat.qute.commons.datamodel.resolvers.ValueResolverInfo in project quarkus-ls by redhat-developer.
the class TemplateGetDataModelProjectTest method assertValueResolver.
private static void assertValueResolver(String namespace, String signature, String sourceType, String named, List<ValueResolverInfo> resolvers) {
Optional<ValueResolverInfo> result = resolvers.stream().filter(r -> signature.equals(r.getSignature())).findFirst();
Assert.assertFalse("Find '" + signature + "' value resolver.", result.isEmpty());
ValueResolverInfo resolver = result.get();
Assert.assertEquals(namespace, resolver.getNamespace());
Assert.assertEquals(signature, resolver.getSignature());
Assert.assertEquals(sourceType, resolver.getSourceType());
}
use of com.redhat.qute.commons.datamodel.resolvers.ValueResolverInfo in project quarkus-ls by redhat-developer.
the class TemplateGetDataModelProjectTest method quteQuickStart.
@Test
public void quteQuickStart() throws Exception {
loadMavenProject(QuteMavenProjectName.qute_quickstart);
QuteDataModelProjectParams params = new QuteDataModelProjectParams(QuteMavenProjectName.qute_quickstart);
DataModelProject<DataModelTemplate<DataModelParameter>> project = QuteSupportForTemplate.getInstance().getDataModelProject(params, getJDTUtils(), new NullProgressMonitor());
Assert.assertNotNull(project);
// Test templates
testTemplates(project);
// Test value resolvers
List<ValueResolverInfo> resolvers = project.getValueResolvers();
Assert.assertNotNull(resolvers);
Assert.assertFalse(resolvers.isEmpty());
testValueResolversFomTemplateExtension(resolvers);
testValueResolversFomInject(resolvers);
}
Aggregations