@SuppressWarnings("unchecked") public static void add(Widget widget) { ServiceStore serviceStore = ContextProvider.getServiceStore(); List<Widget> disposalList = (List<Widget>) serviceStore.getAttribute(DISPOSAL_LIST); if (disposalList == null) { disposalList = new LinkedList<Widget>(); serviceStore.setAttribute(DISPOSAL_LIST, disposalList); } disposalList.add(widget); }
@SuppressWarnings("unchecked") public static Widget[] getAll() { Widget[] result; ServiceStore serviceStore = ContextProvider.getServiceStore(); List<Widget> disposalList = (List<Widget>) serviceStore.getAttribute(DISPOSAL_LIST); if (disposalList == null) { result = new Widget[0]; } else { result = new Widget[disposalList.size()]; disposalList.toArray(result); } return result; }