uschindler commented on a change in pull request #1360: LUCENE-9281: First 
mockup of SPIClassIterator retirement
URL: https://github.com/apache/lucene-solr/pull/1360#discussion_r397336753
 
 

 ##########
 File path: 
lucene/analysis/common/src/java/org/apache/lucene/analysis/util/AnalysisSPILoader.java
 ##########
 @@ -143,6 +144,24 @@ public S newInstance(String name, Map<String,String> 
args) {
   public Set<String> availableServices() {
     return originalNames;
   }  
+
+  /**
+   * Looks up SPI name (static "NAME" field) with appropriate modifiers.
+   * Also it must be a String class and declared in the concrete class.
+   * @return the SPI name
+   * @throws NoSuchFieldException - if the "NAME" field is not defined.
+   * @throws IllegalAccessException - if the "NAME" field is inaccessible.
+   * @throws IllegalStateException - if the "NAME" field does not have 
appropriate modifiers or isn't a String field.
+   */
+  public static String lookupSPIName(Class<? extends AbstractAnalysisFactory> 
service) throws NoSuchFieldException, IllegalAccessException, 
IllegalStateException {
 
 Review comment:
   I thought that this method is useful if you want to figure out the name of a 
factory where you only have class reference. There is no reason to hide it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to