Wildcard for Data Maps in ChartModels

UI Components for JSF
Post Reply
mguinn10
Posts: 2
Joined: 23 Oct 2017, 21:33

23 Jan 2018, 19:00

Hey all, first post here, so sorry if this is not the correct place to ask this. I have a situation where I would like to allow my user to create flexible reports and display them using a chart model of their choice. The code behind this can get messy with lots of switch/case for determining how to handle a lot of conditions (what data? what model? how to display?) so I'm making an effort to make sure I have plenty of reusable generic code in private methods. The problem I'm running into is creating data maps that could be used by both basic chart models like pie charts, and cartesian models like bar charts (when they are single-series). One takes a Map<String, Number> while the other takes a Map<Object, Number>

I can get around this problem by iterating through my String-Number map from my generic data gathering method and casting each key to Object, but I was wondering if there was any reason the API needs to require Map<Object,Number> rather than Map<? extends Object, Number>? Are there use-cases that I'm not aware of where cartesian series models are adding Objects to the collection within the API that wouldn't be safe using the wildcard?

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 50 guests