001package org.intellimate.izou.identification; 002 003import org.intellimate.izou.util.IzouModule; 004import org.intellimate.izou.addon.AddOnModel; 005import org.intellimate.izou.main.Main; 006import ro.fortsoft.pf4j.IzouPluginClassLoader; 007 008/** 009 * the internal IdentificationManager provides various methods handle Identifiables/Identifications 010 * @author LeanderK 011 * @version 1.0 012 */ 013public class InternalIdentificationManager extends IzouModule { 014 015 public InternalIdentificationManager(Main main) { 016 super(main); 017 } 018 019 /** 020 * gets the AddonModel for the Identification, or null if none found 021 * @param identification the Identification 022 * @return an AddonModel or null 023 */ 024 public AddOnModel getAddonModel(Identification identification) { 025 Identifiable identifiable = identification.getIdentifiable(); 026 if (identifiable.getClass().getClassLoader() instanceof IzouPluginClassLoader && !identifiable.getClass().getName().toLowerCase() 027 .contains(IzouPluginClassLoader.PLUGIN_PACKAGE_PREFIX_IZOU_SDK)) { 028 return getMain().getAddOnManager().getAddOnForClassLoader(identifiable.getClass().getClassLoader()) 029 .orElse(null); 030 } 031 return null; 032 } 033}