2 * Copyright (c) 2014 Cable Television Laboratories, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.pcmm.objects;
11 import java.util.HashMap;
15 * This stores and handles the PCMM resources.
18 public class PCMMResourceSet {
20 private Map<Object, PCMMResourcesMapper<?, ?>> mapper;
22 private static PCMMResourceSet instance;
24 private PCMMResourceSet() {
25 mapper = new HashMap<Object, PCMMResourcesMapper<?, ?>>();
28 public static PCMMResourceSet getInstance() {
30 instance = new PCMMResourceSet();
38 * to be used for identifying mapped structure
39 * @return resource mapper
41 @SuppressWarnings("unchecked")
42 public <M, T extends PCMMResource> PCMMResourcesMapper<M, T> getMappedResources(
44 return (PCMMResourcesMapper<M, T>) mapper.get(key);
47 public <M, T extends PCMMResource> void mapResources(Object key,
48 PCMMResourcesMapper<M, T> resources) {
49 mapper.put(key, resources);
52 public void removeMapping(Object key) {
56 public void removeAllMappings() {