package de.avatic.taricdb.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

@Service
public class ReferenceStorageService {
	
	Map<Class<?>, List<Object>> references = new HashMap<>();

	public void addAll(List<Object> entities, Class<?> entityType, Class<?> idType) {
		
		if(references.containsKey(entityType)) {
			references.get(entityType).addAll(entities);
		} else {
			references.put(entityType, entities);
		}
	}
	
	@SuppressWarnings("unchecked")
	public <T> List<T> getEntites(Class<T> entityType) {
		return (List<T>) references.get(entityType);
	}
}
