package org.gcube.informationsystem.discovery.model.knowledge; import java.util.LinkedHashSet; import java.util.Set; import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.tree.NodeInformation; import org.gcube.informationsystem.types.TypeMapper; /** * @author Luca Frosini (ISTI - CNR) */ public class ClassInformation implements NodeInformation> { @Override public String getIdentifier(Class clz) { return TypeMapper.getType(clz); } @Override public Set getParentIdentifiers(Class root, Class clz) { Set ret = new LinkedHashSet<>(); if(clz == root) { return ret; } Class[] interfaces = clz.getInterfaces(); for(Class i : interfaces) { if(root.isAssignableFrom(i)) { @SuppressWarnings("unchecked") String id = getIdentifier((Class) i); ret.add(id); } } return ret; } }