[ 
https://issues.apache.org/jira/browse/COMMONSRDF-47?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15615760#comment-15615760
 ] 

ASF GitHub Bot commented on COMMONSRDF-47:
------------------------------------------

GitHub user stain opened a pull request:

    https://github.com/apache/incubator-commonsrdf/pull/27

    COMMONSRDF-47 RDFSyntax as an interface

    [COMMONSRDF-47](https://issues.apache.org/jira/browse/COMMONSRDF-47)
    
    RDFSyntax  as an interface, with OfficialRDFSyntax is the enum - which 
implements the interface
    
    basically .mediaType -> .mediaType() etc
    
    One problem is that you can't override `.equals()` on an enum - and 
presumably it might be useful to compare if two RDFSyntaxes are the same? 
    
    Do we need to add our own `.equals()` and `.hashCode()` contract here as 
well (using `mediaType()`)  and get rid of the enum?
    
    we will also have to tweak the japicmp config as it (rightfully) complains 
about `RDFSyntax` changing its signature since 0.2.0, e.g. 
    
    ```
    ***! MODIFIED INTERFACE (<- ENUM) : PUBLIC ABSTRACT (<- NON_ABSTRACT) 
NON_FINAL (<- FINAL) org.apache.commons.rdf.api.RDFSyntax  (class type modified)
            ---* REMOVED INTERFACE: java.lang.Comparable
            ---* REMOVED INTERFACE: java.io.Serializable
            ***! MODIFIED SUPERCLASS: java.lang.Object (<- java.lang.Enum)
            ***! MODIFIED FIELD: PUBLIC STATIC FINAL 
org.apache.commons.rdf.api.RDFSyntax$OfficialRDFSyntax (<- 
org.apache.commons.rdf.api.RDFSyntax) RDFA_XHTML
            ***! MODIFIED FIELD: PUBLIC STATIC FINAL 
org.apache.commons.rdf.api.RDFSyntax$OfficialRDFSyntax (<- 
org.apache.commons.rdf.api.RDFSyntax) NQUADS
            ***! MODIFIED FIELD: PUBLIC STATIC FINAL 
org.apache.commons.rdf.api.RDFSyntax$OfficialRDFSyntax (<- 
org.apache.commons.rdf.api.RDFSyntax) RDFA_HTML
            ---! REMOVED FIELD: PUBLIC(-) FINAL(-) java.lang.String mediaType
            ---! REMOVED FIELD: PUBLIC(-) FINAL(-) boolean supportsDataset
            ***! MODIFIED FIELD: PUBLIC STATIC FINAL 
org.apache.commons.rdf.api.RDFSyntax$OfficialRDFSyntax (<- 
org.apache.commons.rdf.api.RDFSyntax) RDFXML
            ---! REMOVED FIELD: PUBLIC(-) FINAL(-) java.lang.String 
fileExtension
            ***! MODIFIED FIELD: PUBLIC STATIC FINAL 
org.apache.commons.rdf.api.RDFSyntax$OfficialRDFSyntax (<- 
org.apache.commons.rdf.api.RDFSyntax) TURTLE
            ***! MODIFIED FIELD: PUBLIC STATIC FINAL 
org.apache.commons.rdf.api.RDFSyntax$OfficialRDFSyntax (<- 
org.apache.commons.rdf.api.RDFSyntax) NTRIPLES
            ***! MODIFIED FIELD: PUBLIC STATIC FINAL 
org.apache.commons.rdf.api.RDFSyntax$OfficialRDFSyntax (<- 
org.apache.commons.rdf.api.RDFSyntax) TRIG
            ***! MODIFIED FIELD: PUBLIC STATIC FINAL 
org.apache.commons.rdf.api.RDFSyntax$OfficialRDFSyntax (<- 
org.apache.commons.rdf.api.RDFSyntax) JSONLD
            +++* NEW METHOD: PUBLIC(+) ABSTRACT(+) java.lang.String 
fileExtension()
            +++* NEW METHOD: PUBLIC(+) ABSTRACT(+) java.lang.String mediaType()
            +++* NEW METHOD: PUBLIC(+) ABSTRACT(+) java.lang.String name()
            +++* NEW METHOD: PUBLIC(+) ABSTRACT(+) boolean supportsDataset()
            +++* NEW METHOD: PUBLIC(+) ABSTRACT(+) java.lang.String title()
            ---  REMOVED METHOD: PUBLIC(-) java.lang.String toString()
            ---! REMOVED METHOD: PUBLIC(-) STATIC(-) 
org.apache.commons.rdf.api.RDFSyntax valueOf(java.lang.String)
            ---! REMOVED METHOD: PUBLIC(-) STATIC(-) 
org.apache.commons.rdf.api.RDFSyntax[] values()
    ```
    
    My suggestion is to delay this till past 0.3.0, as we're not settling 
`RDFParser` now anyway.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/incubator-commonsrdf COMMONSRDF-47

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-commonsrdf/pull/27.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #27
    
----
commit ee725a5aaf5d94c9ab5ff7f355bb5d0cb370bfa7
Author: Stian Soiland-Reyes <st...@apache.org>
Date:   2016-10-28T15:34:49Z

    COMMONSRDF-47 RDFSyntax as an interface
    
    OfficialRDFSyntax is the enum - which implements the interface
    
    basically .mediaType -> .mediaType() etc

----


> RDFSyntax should be interface, not enum
> ---------------------------------------
>
>                 Key: COMMONSRDF-47
>                 URL: https://issues.apache.org/jira/browse/COMMONSRDF-47
>             Project: Apache Commons RDF
>          Issue Type: Bug
>          Components: api
>    Affects Versions: 0.2.0
>            Reporter: Stian Soiland-Reyes
>            Assignee: Stian Soiland-Reyes
>
> [~p_ansell] raises in [pull request 
> 25|https://github.com/apache/incubator-commonsrdf/pull/25#discussion_r85231845]
> {quote}
> Using enum for RDFSyntax is a bad idea unless it overrides an interface and 
> the interface is used in method signatures instead of the enum. There are 
> many other RDFSyntaxes, and enum (without implementing an interface) is only 
> suited to cases where the full set are known a priori.
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to