android-rss icon indicating copy to clipboard operation
android-rss copied to clipboard

Add possibility to add new tags

Open k-misztal opened this issue 8 years ago • 4 comments

Add some kind of API that allows devs to add support for new tags. It can by adding setters to RSSHandler. I have to handle RSS feed where instead of pubDate there is dc:date, and there is no possibility to use that library.

k-misztal avatar Aug 20 '17 18:08 k-misztal

A perhaps down-to-earth design could be to add another RSSHandler constructor that takes as input other setters in the hash-map. Of course, the problem with such a design is that it does not address the need of having to generate the appropriate getters and setters in RSSFeed or RSSBase. This is a sort of strong coupling that would be cumbersome to maintain over time, and it is not the kind of flexible extension system you may have in mind.

A better design would probably use annotations in the style of JAX-RS. But that is a significant redesign for which, I am afraid, I may not be able to find the cycles right now.

ahorn avatar Aug 29 '17 17:08 ahorn

I can see the problem now. I didn't go into your code a lot, but what with playing with generics? Something like:

class RSSHandler<T extends RSSBase> {

  private T item;
  
  public RSSHandler(Map<String, Setter<T> customSetters) {
    ...
  }

  interface Setter<F extends RSSBase> {
    void set(F item, Object data)
  }
  
}

Like this you can change what exact implementation of RSSBase is stored inside of handler.

k-misztal avatar Sep 03 '17 15:09 k-misztal

Hi @k-misztal

For some time now, I wanted to update the README with references to projects/products that are using android-rss. If you are willing to share any of this information, I would be grateful if you could respond with the project name or product that is using android-rss.

Many thanks in advance.

ahorn avatar Oct 21 '17 16:10 ahorn

In the end I've used Simple XML - I had to support few extra tags, especially that I fetched data from both RSS1.0 and RSS2.0. But it was nothing fancy, really simple project.

k-misztal avatar Oct 24 '17 09:10 k-misztal