use of org.springframework.ide.vscode.commons.java.IType in project sts4 by spring-projects.
the class HtmlJavadocTest method html_testNoJavadocClass.
@Test
public void html_testNoJavadocClass() throws Exception {
MavenJavaProject project = projectSupplier.get();
;
IType type = project.getClasspath().findType("hello.GreetingController");
assertNotNull(type);
assertNull(type.getJavaDoc());
}
use of org.springframework.ide.vscode.commons.java.IType in project sts4 by spring-projects.
the class JavaIndexTest method findClassInJar.
@Test
public void findClassInJar() throws Exception {
MavenJavaProject project = mavenProjectsCache.get("gs-rest-service-cors-boot-1.4.1-with-classpath-file");
IType type = project.getClasspath().findType("org.springframework.test.web.client.ExpectedCount");
assertNotNull(type);
}
use of org.springframework.ide.vscode.commons.java.IType in project sts4 by spring-projects.
the class JavaIndexTest method voidConstructor.
@Test
public void voidConstructor() throws Exception {
MavenJavaProject project = mavenProjectsCache.get("gs-rest-service-cors-boot-1.4.1-with-classpath-file");
IType type = project.getClasspath().findType("java.util.ArrayList");
assertNotNull(type);
IMethod m = type.getMethod("<init>", Stream.empty());
assertEquals(type.getElementName(), m.getElementName());
assertEquals(IVoidType.DEFAULT, m.getReturnType());
assertEquals(0, m.parameters().count());
}
use of org.springframework.ide.vscode.commons.java.IType in project sts4 by spring-projects.
the class JavaIndexTest method constructorMethodWithParams.
@Test
public void constructorMethodWithParams() throws Exception {
MavenJavaProject project = mavenProjectsCache.get("gs-rest-service-cors-boot-1.4.1-with-classpath-file");
IType type = project.getClasspath().findType("java.util.ArrayList");
assertNotNull(type);
IMethod m = type.getMethod("<init>", Stream.of(IPrimitiveType.INT));
assertEquals(m.getDeclaringType().getElementName(), m.getElementName());
assertEquals(IVoidType.DEFAULT, m.getReturnType());
assertEquals(Collections.singletonList(IPrimitiveType.INT), m.parameters().collect(Collectors.toList()));
}
use of org.springframework.ide.vscode.commons.java.IType in project sts4 by spring-projects.
the class TypeUtil method getSetter.
public Optional<IMethod> getSetter(Type beanType, String propName) {
try {
String setterName = "set" + StringUtil.hyphensToCamelCase(propName, true);
IType type = findType(beanType);
return type.getMethods().filter(m -> setterName.equals(m.getElementName())).findFirst();
} catch (Exception e) {
Log.log(e);
}
return Optional.empty();
}
Aggregations