Jan Martin Keil created JENA-1955:
-------------------------------------

             Summary: Make use of Optional or NoSuchElementException
                 Key: JENA-1955
                 URL: https://issues.apache.org/jira/browse/JENA-1955
             Project: Apache Jena
          Issue Type: Improvement
            Reporter: Jan Martin Keil


Many methods currently return {{null}} or an empty String, if something was not 
present. It would significantly ease writing stable and fault-tolerant code, if 
this methods would be replaced be methods returning an {{java.util.Optional}} 
(preferred) or throwing an {{NoSuchElementException}} instead.

Best way to do that would probably be to deprecate the current methods for the 
time being and add new methods using {{java.util.Optional}} or 
{{NoSuchElementException}}.

An probably incomplete/example list of affected methods:
* {{QuerySolution#get(String)}}
* {{QuerySolution#getResource(String)}}
* {{QuerySolution#getLiteral(String)}}
* {{Literal#getLanguage()}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to