[
https://issues.apache.org/jira/browse/JENA-1955?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jan Martin Keil updated JENA-1955:
----------------------------------
Description:
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()}}
was:
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()}}
> 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
> Priority: Major
>
> 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)