Re: Generic RDFVisitor
I don't actually have a use case for the generics. I just saw that the interface was implemented in a pre-Java 5 style and wondered if it would help to modernize it, without breaking backwards compatibility of course. If the interface isn't used much, that probably answers my question. :) From: ajs6f <aj...@apache.org> Sent: Friday, November 17, 2017 11:03 AM To: dev@jena.apache.org Subject: Re: Generic RDFVisitor Perhaps you can say a little more about your use case here? I think we could probably work something out for this feature, but I am curious about why you are reaching for the visitor pattern? ajs6f > On Nov 17, 2017, at 11:27 AM, Adam Jacobs <jacobs_...@hotmail.com> wrote: > > Perhaps only a single generic parameter then, if each method should return > the same type. > Or a sub-interface in which all three parameters are the same, the way that > Java's `UnaryOperator` is related to `Function`. > > > > From: ajs6f <aj...@apache.org> > Sent: Friday, November 17, 2017 10:01 AM > To: dev@jena.apache.org > Subject: Re: Generic RDFVisitor > > Not sure how that would play against: > > Object org.apache.jena.rdf.model.impl.ResourceImpl.visitWith(RDFVisitor) > > OTOH, I'm not sure how much use the visitor pattern there has ever really > gotten... > > ajs6f > >> On Nov 17, 2017, at 10:55 AM, Adam Jacobs <jacobs_...@hotmail.com> wrote: >> >> I wonder if it would be useful to generify the `RDFVisitor` interface... >> >> public interface RDFVisitor<B,U,L> { >> >> B visitBlank( Resource r, AnonId id ); >> U visitURI( Resource r, String uri ); >> L visitLiteral( Literal l ); >> >> } >
Re: Generic RDFVisitor
Perhaps you can say a little more about your use case here? I think we could probably work something out for this feature, but I am curious about why you are reaching for the visitor pattern? ajs6f > On Nov 17, 2017, at 11:27 AM, Adam Jacobs <jacobs_...@hotmail.com> wrote: > > Perhaps only a single generic parameter then, if each method should return > the same type. > Or a sub-interface in which all three parameters are the same, the way that > Java's `UnaryOperator` is related to `Function`. > > > > From: ajs6f <aj...@apache.org> > Sent: Friday, November 17, 2017 10:01 AM > To: dev@jena.apache.org > Subject: Re: Generic RDFVisitor > > Not sure how that would play against: > > Object org.apache.jena.rdf.model.impl.ResourceImpl.visitWith(RDFVisitor) > > OTOH, I'm not sure how much use the visitor pattern there has ever really > gotten... > > ajs6f > >> On Nov 17, 2017, at 10:55 AM, Adam Jacobs <jacobs_...@hotmail.com> wrote: >> >> I wonder if it would be useful to generify the `RDFVisitor` interface... >> >> public interface RDFVisitor<B,U,L> { >> >> B visitBlank( Resource r, AnonId id ); >> U visitURI( Resource r, String uri ); >> L visitLiteral( Literal l ); >> >> } >
Re: Generic RDFVisitor
Perhaps only a single generic parameter then, if each method should return the same type. Or a sub-interface in which all three parameters are the same, the way that Java's `UnaryOperator` is related to `Function`. From: ajs6f <aj...@apache.org> Sent: Friday, November 17, 2017 10:01 AM To: dev@jena.apache.org Subject: Re: Generic RDFVisitor Not sure how that would play against: Object org.apache.jena.rdf.model.impl.ResourceImpl.visitWith(RDFVisitor) OTOH, I'm not sure how much use the visitor pattern there has ever really gotten... ajs6f > On Nov 17, 2017, at 10:55 AM, Adam Jacobs <jacobs_...@hotmail.com> wrote: > > I wonder if it would be useful to generify the `RDFVisitor` interface... > > public interface RDFVisitor<B,U,L> { > >B visitBlank( Resource r, AnonId id ); >U visitURI( Resource r, String uri ); >L visitLiteral( Literal l ); > > }
Re: Generic RDFVisitor
Not sure how that would play against: Object org.apache.jena.rdf.model.impl.ResourceImpl.visitWith(RDFVisitor) OTOH, I'm not sure how much use the visitor pattern there has ever really gotten... ajs6f > On Nov 17, 2017, at 10:55 AM, Adam Jacobswrote: > > I wonder if it would be useful to generify the `RDFVisitor` interface... > > public interface RDFVisitor { > >B visitBlank( Resource r, AnonId id ); >U visitURI( Resource r, String uri ); >L visitLiteral( Literal l ); > > }