java - Identify specific class when multiple classes of same name -
i have 2 projects included genxml
project, framework1
, framework2
. framework2
updated version of framework1
, both have class abstractscreentest.class
. there anyway in code below can specify project want interact with?
classpathscanningcandidatecomponentprovider provider = new classpathscanningcandidatecomponentprovider(true); provider.addincludefilter(new assignabletypefilter(abstractscreentest.class)); set<beandefinition> components = provider.findcandidatecomponents(candiatepackage); (beandefinition component : components){ cls = class.forname(component.getbeanclassname()); classlist.add(cls.getname().tostring()); }
you add @deprecated annotation old (out-dated) class , verify component not contain deprecated annotation.
for (beandefinition component : components){ cls = class.forname(component.getbeanclassname()); if (!cls.isannotationpresent(deprecated.class) { classlist.add(cls.getname().tostring()); } }
of course, assumes there aren't other deprecated classes want add class list. in case, write new annotation stamp old class with, although ideal rid of dependency on outdated class.
Comments
Post a Comment