SLING-7624 use PREFIX_ to make annotation methods less verbose

Separate servlet name property into dedicated property
diff --git a/src/main/java/org/apache/sling/servlets/annotations/SlingServletByPath.java b/src/main/java/org/apache/sling/servlets/annotations/SlingServletByPath.java
index 82c1609..d244457 100644
--- a/src/main/java/org/apache/sling/servlets/annotations/SlingServletByPath.java
+++ b/src/main/java/org/apache/sling/servlets/annotations/SlingServletByPath.java
@@ -33,6 +33,11 @@
 public @interface SlingServletByPath {
 
     /**
+     * Prefix for every property being generated from the annotations elements (as defined in OSGi 7 Compendium, 112.8.2.1)
+     */
+    static final String PREFIX_ = "sling.servlet.";
+    
+    /**
      * The absolute paths under which the servlet is accessible as a resource.
      * A relative path is made absolute by prefixing it with the value set through the
      * {@link #sling_servlet_prefix()} element.
@@ -47,7 +52,7 @@
      * 
      * @see ServletResolverConstants#SLING_SERVLET_PATHS
      */
-    String[] sling_servlet_paths();
+    String[] paths();
     
     /**
      * The prefix/index to be used to register this servlet.
@@ -71,14 +76,5 @@
      * In case even that one is not set "/" is used as prefix.
      * @see ServletResolverConstants#SLING_SERVLET_PREFIX
      */
-    String sling_servlet_prefix() default "";
-    
-    /**
-     * Containing the name of the servlet. If this is empty, the
-     * <code>component.name</code> property or the <code>service.pid</code>
-     * is used. If none of the three properties is defined, the Servlet is
-     * ignored.
-     * @see ServletResolverConstants#SLING_SERVLET_NAME
-     */
-    String sling_core_servletName() default "";
+    String prefix() default "";
 }
diff --git a/src/main/java/org/apache/sling/servlets/annotations/SlingServletByResourceType.java b/src/main/java/org/apache/sling/servlets/annotations/SlingServletByResourceType.java
index 75b001f..c9dc6d6 100644
--- a/src/main/java/org/apache/sling/servlets/annotations/SlingServletByResourceType.java
+++ b/src/main/java/org/apache/sling/servlets/annotations/SlingServletByResourceType.java
@@ -30,13 +30,18 @@
 public @interface SlingServletByResourceType {
 
     /**
+     * Prefix for every property being generated from the annotations elements (as defined in OSGi 7 Compendium, 112.8.2.1)
+     */
+    static final String PREFIX_ = "sling.servlet.";
+
+    /**
      * The resource type(s) supported by the servlet (value
      * is "sling.servlet.resourceTypes").
      * A relative resource type is made absolute by prefixing it with the value set through the
      * {@link #sling_servlet_prefix()} property.
      * <p>
      */
-    String[] sling_servlet_resourceTypes();
+    String[] resourceTypes();
     
     /**
      * One ore more request URL selectors supported by the servlet. The
@@ -46,7 +51,7 @@
      * otherwise the servlet is not executed. After that may follow arbitrarily many non-registered selectors.
      * @see ServletResolverConstants#SLING_SERVLET_SELECTORS
      */
-    String[] sling_servlet_selectors() default {};
+    String[] selectors() default {};
     
     /**
      * The request URL extensions supported by the servlet
@@ -55,7 +60,7 @@
      * It this is not set, the servlet is not limited to certain extensions.
      * @see ServletResolverConstants#SLING_SERVLET_EXTENSIONS
      */
-    String[] sling_servlet_extensions() default {};
+    String[] extensions() default {};
     
     /**
      * The request methods supported by the servlet. The value may be one of the HTTP 
@@ -65,7 +70,7 @@
      * @see ServletResolverConstants#SLING_SERVLET_METHODS
      * @see <a href="https://tools.ietf.org/html/rfc7231#section-4.3">HTTP 1.1 Spec Methods</a>
      */
-    String[] sling_servlet_methods() default {};
+    String[] methods() default {};
     
     /**
      * The prefix/index to be used to register this servlet.
@@ -89,14 +94,5 @@
      * In case even that one is not set "/" is used as prefix.
      * @see ServletResolverConstants#SLING_SERVLET_PREFIX
      */
-    String sling_servlet_prefix() default "";
-    
-    /**
-     * Containing the name of the servlet. If this is empty, the
-     * <code>component.name</code> property or the <code>service.pid</code>
-     * is used. If none of the three properties is defined, the Servlet is
-     * ignored.
-     * @see ServletResolverConstants#SLING_SERVLET_NAME
-     */
-    String sling_core_servletName() default "";
+    String prefix() default "";
 }
diff --git a/src/main/java/org/apache/sling/servlets/annotations/SlingServletName.java b/src/main/java/org/apache/sling/servlets/annotations/SlingServletName.java
new file mode 100644
index 0000000..79dd1f9
--- /dev/null
+++ b/src/main/java/org/apache/sling/servlets/annotations/SlingServletName.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.servlets.annotations;
+
+import org.apache.sling.api.servlets.ServletResolverConstants;
+import org.osgi.service.component.annotations.ComponentPropertyType;
+
+/**
+ * Component Property Type (as defined by OSGi DS 1.4) for Sling Servlets.
+ * Takes care of writing the relevant component properties to set a name for a Sling Servlet.
+ * Must be combined with either {@link SlingServletByResourceType} or {@link SlingServletByPath}.
+ *
+ * @see <a href="https://github.com/apache/felix/blob/trunk/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingServlet.java">Felix SCR annotations</a>
+ * @see ServletResolverConstants
+ */
+@ComponentPropertyType
+public @interface SlingServletName {
+    /**
+     * Prefix for every property being generated from the annotations elements (as defined in OSGi 7 Compendium, 112.8.2.1)
+     */
+    static final String PREFIX_ = "sling.core.";
+
+    /**
+     * Containing the name of the servlet. If this is empty (or not set), the
+     * <code>component.name</code> property or the <code>service.pid</code>
+     * is used. If none of the three properties is defined, the Servlet is
+     * ignored.
+     * @see ServletResolverConstants#SLING_SERVLET_NAME
+     */
+    String servletName();
+}