You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "Jason Gerlowski (Jira)" <ji...@apache.org> on 2024/04/30 18:34:00 UTC

[jira] [Created] (SOLR-17262) Add SolrParams-style convenience methods to NamedList

Jason Gerlowski created SOLR-17262:
--------------------------------------

             Summary: Add SolrParams-style convenience methods to NamedList
                 Key: SOLR-17262
                 URL: https://issues.apache.org/jira/browse/SOLR-17262
             Project: Solr
          Issue Type: Improvement
      Security Level: Public (Default Security Level. Issues are Public)
    Affects Versions: main (10.0)
            Reporter: Jason Gerlowski


Most NamedList<T> getters return values using the generic type 'T'.  On the surface this seems to make perfect sense, but it often isn't very helpful since NamedList is frequently used to hold heterogeneous types, so in practice NamedLists are almost always declared with 'T' == 'Object'.

As a result, the large majority of NamedList code has to either cast and/or parse the value to its actual type after each list-access.

SolrParams gets around a similar problem by having a number of convenience methods that return specific common types or throw a uniform error message.  Examples include: getLong, getFloat, getDouble, etc.

We should add similar methods to NamedList, and then start to use those throughout the codebase in an effort to make arg-parsing code more readable and uniform.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org