Moved request mapping annotations constants to Annotations
This commit is contained in:
@@ -21,6 +21,13 @@ public class Annotations {
|
||||
public static final String COMPONENT = "org.springframework.stereotype.Component";
|
||||
public static final String AUTOWIRED = "org.springframework.beans.factory.annotation.Autowired";
|
||||
|
||||
public static final String SPRING_REQUEST_MAPPING = "org.springframework.web.bind.annotation.RequestMapping";
|
||||
public static final String SPRING_GET_MAPPING = "org.springframework.web.bind.annotation.GetMapping";
|
||||
public static final String SPRING_POST_MAPPING = "org.springframework.web.bind.annotation.PostMapping";
|
||||
public static final String SPRING_PUT_MAPPING = "org.springframework.web.bind.annotation.PutMapping";
|
||||
public static final String SPRING_DELETE_MAPPING = "org.springframework.web.bind.annotation.DeleteMapping";
|
||||
public static final String SPRING_PATCH_MAPPING = "org.springframework.web.bind.annotation.PatchMapping";
|
||||
|
||||
public static final String CONDITIONAL = "org.springframework.context.annotation.Conditional";
|
||||
public static final String CONDITIONAL_ON_BEAN = "org.springframework.boot.autoconfigure.condition.ConditionalOnBean";
|
||||
public static final String CONDITIONAL_ON_MISSING_BEAN = "org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean";
|
||||
|
||||
@@ -245,17 +245,17 @@ public class BootJavaLanguageServer extends SimpleLanguageServer {
|
||||
|
||||
providers.put(org.springframework.ide.vscode.boot.java.value.Constants.SPRING_VALUE, new ValueHoverProvider());
|
||||
|
||||
providers.put(org.springframework.ide.vscode.boot.java.requestmapping.Constants.SPRING_REQUEST_MAPPING,
|
||||
providers.put(Annotations.SPRING_REQUEST_MAPPING,
|
||||
new RequestMappingHoverProvider());
|
||||
providers.put(org.springframework.ide.vscode.boot.java.requestmapping.Constants.SPRING_GET_MAPPING,
|
||||
providers.put(Annotations.SPRING_GET_MAPPING,
|
||||
new RequestMappingHoverProvider());
|
||||
providers.put(org.springframework.ide.vscode.boot.java.requestmapping.Constants.SPRING_POST_MAPPING,
|
||||
providers.put(Annotations.SPRING_POST_MAPPING,
|
||||
new RequestMappingHoverProvider());
|
||||
providers.put(org.springframework.ide.vscode.boot.java.requestmapping.Constants.SPRING_PUT_MAPPING,
|
||||
providers.put(Annotations.SPRING_PUT_MAPPING,
|
||||
new RequestMappingHoverProvider());
|
||||
providers.put(org.springframework.ide.vscode.boot.java.requestmapping.Constants.SPRING_DELETE_MAPPING,
|
||||
providers.put(Annotations.SPRING_DELETE_MAPPING,
|
||||
new RequestMappingHoverProvider());
|
||||
providers.put(org.springframework.ide.vscode.boot.java.requestmapping.Constants.SPRING_PATCH_MAPPING,
|
||||
providers.put(Annotations.SPRING_PATCH_MAPPING,
|
||||
new RequestMappingHoverProvider());
|
||||
providers.put(Annotations.PROFILE, new ActiveProfilesProvider());
|
||||
|
||||
@@ -305,17 +305,17 @@ public class BootJavaLanguageServer extends SimpleLanguageServer {
|
||||
|
||||
protected SpringIndexer createAnnotationIndexer(SimpleLanguageServer server, JavaProjectFinder projectFinder) {
|
||||
HashMap<String, SymbolProvider> providers = new HashMap<>();
|
||||
providers.put(org.springframework.ide.vscode.boot.java.requestmapping.Constants.SPRING_REQUEST_MAPPING,
|
||||
providers.put(Annotations.SPRING_REQUEST_MAPPING,
|
||||
new RequestMappingSymbolProvider());
|
||||
providers.put(org.springframework.ide.vscode.boot.java.requestmapping.Constants.SPRING_GET_MAPPING,
|
||||
providers.put(Annotations.SPRING_GET_MAPPING,
|
||||
new RequestMappingSymbolProvider());
|
||||
providers.put(org.springframework.ide.vscode.boot.java.requestmapping.Constants.SPRING_POST_MAPPING,
|
||||
providers.put(Annotations.SPRING_POST_MAPPING,
|
||||
new RequestMappingSymbolProvider());
|
||||
providers.put(org.springframework.ide.vscode.boot.java.requestmapping.Constants.SPRING_PUT_MAPPING,
|
||||
providers.put(Annotations.SPRING_PUT_MAPPING,
|
||||
new RequestMappingSymbolProvider());
|
||||
providers.put(org.springframework.ide.vscode.boot.java.requestmapping.Constants.SPRING_DELETE_MAPPING,
|
||||
providers.put(Annotations.SPRING_DELETE_MAPPING,
|
||||
new RequestMappingSymbolProvider());
|
||||
providers.put(org.springframework.ide.vscode.boot.java.requestmapping.Constants.SPRING_PATCH_MAPPING,
|
||||
providers.put(Annotations.SPRING_PATCH_MAPPING,
|
||||
new RequestMappingSymbolProvider());
|
||||
|
||||
providers.put(Annotations.BEAN, new BeansSymbolProvider());
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.boot.java.requestmapping;
|
||||
|
||||
/**
|
||||
* @author Martin Lippert
|
||||
*/
|
||||
public class Constants {
|
||||
|
||||
public static final String SPRING_REQUEST_MAPPING = "org.springframework.web.bind.annotation.RequestMapping";
|
||||
public static final String SPRING_GET_MAPPING = "org.springframework.web.bind.annotation.GetMapping";
|
||||
public static final String SPRING_POST_MAPPING = "org.springframework.web.bind.annotation.PostMapping";
|
||||
public static final String SPRING_PUT_MAPPING = "org.springframework.web.bind.annotation.PutMapping";
|
||||
public static final String SPRING_DELETE_MAPPING = "org.springframework.web.bind.annotation.DeleteMapping";
|
||||
public static final String SPRING_PATCH_MAPPING = "org.springframework.web.bind.annotation.PatchMapping";
|
||||
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import org.eclipse.jdt.core.dom.TypeDeclaration;
|
||||
import org.eclipse.lsp4j.Location;
|
||||
import org.eclipse.lsp4j.SymbolInformation;
|
||||
import org.eclipse.lsp4j.SymbolKind;
|
||||
import org.springframework.ide.vscode.boot.java.Annotations;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolProvider;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
import org.springframework.ide.vscode.commons.util.text.TextDocument;
|
||||
@@ -142,7 +143,7 @@ public class RequestMappingSymbolProvider implements SymbolProvider {
|
||||
Annotation annotation = (Annotation) modifier;
|
||||
ITypeBinding resolvedType = annotation.resolveTypeBinding();
|
||||
String annotationType = resolvedType.getQualifiedName();
|
||||
if (annotationType != null && Constants.SPRING_REQUEST_MAPPING.equals(annotationType)) {
|
||||
if (annotationType != null && Annotations.SPRING_REQUEST_MAPPING.equals(annotationType)) {
|
||||
return annotation;
|
||||
}
|
||||
}
|
||||
@@ -155,15 +156,15 @@ public class RequestMappingSymbolProvider implements SymbolProvider {
|
||||
ITypeBinding type = annotation.resolveTypeBinding();
|
||||
if (type != null) {
|
||||
switch (type.getQualifiedName()) {
|
||||
case Constants.SPRING_GET_MAPPING:
|
||||
case Annotations.SPRING_GET_MAPPING:
|
||||
return new String[] { "GET" };
|
||||
case Constants.SPRING_POST_MAPPING:
|
||||
case Annotations.SPRING_POST_MAPPING:
|
||||
return new String[] { "POST" };
|
||||
case Constants.SPRING_DELETE_MAPPING:
|
||||
case Annotations.SPRING_DELETE_MAPPING:
|
||||
return new String[] { "DELETE" };
|
||||
case Constants.SPRING_PUT_MAPPING:
|
||||
case Annotations.SPRING_PUT_MAPPING:
|
||||
return new String[] { "PUT" };
|
||||
case Constants.SPRING_PATCH_MAPPING:
|
||||
case Annotations.SPRING_PATCH_MAPPING:
|
||||
return new String[] { "PATCH" };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,9 +27,9 @@ import org.apache.commons.io.FileUtils;
|
||||
import org.eclipse.lsp4j.SymbolInformation;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.ide.vscode.boot.java.Annotations;
|
||||
import org.springframework.ide.vscode.boot.java.BootJavaLanguageServer;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolProvider;
|
||||
import org.springframework.ide.vscode.boot.java.requestmapping.Constants;
|
||||
import org.springframework.ide.vscode.boot.java.requestmapping.RequestMappingSymbolProvider;
|
||||
import org.springframework.ide.vscode.boot.java.utils.SpringIndexer;
|
||||
import org.springframework.ide.vscode.commons.maven.MavenCore;
|
||||
@@ -53,7 +53,7 @@ public class SpringIndexerTest {
|
||||
@Before
|
||||
public void setup() throws Exception {
|
||||
symbolProviders = new HashMap<>();
|
||||
symbolProviders.put(Constants.SPRING_REQUEST_MAPPING, new RequestMappingSymbolProvider());
|
||||
symbolProviders.put(Annotations.SPRING_REQUEST_MAPPING, new RequestMappingSymbolProvider());
|
||||
harness = BootLanguageServerHarness.builder().build();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user