Adam
2009-12-03 21:11:27 UTC
Hello,
What is the best way to find the classes that extend from another class?
For example, if I want to find all the classes that extend from
SalesTableType, currently, I'm doing this.
==================================================
UtilIdELements utilidelements;
SysDictClass sysdictclass;
;
while select utilidelements
where utilidelements.recordtype == UtilElementType::Class
&& utilidelements.name like 'SalesTableType*'
{
sysdictclass = new SysDictClass(utilidelements.id);
if((sysdictclass != null)
&& !sysdictclass.isAbstract()
&& sysdictclass.isExtending(classnum(SalesTableType)))
{
info(sysdictclass.name());
}
}
==================================================
I'm just curious if there's a better way. I hate doing the while select and
checking for the name, then instantiating the sysdictclass object just to
check if it extends from the class I'm looking for. Also this has a flaw
that there could be classes extending from SalesTableType which do not have a
name like "SalesTableType*". Is there a better way of getting this
information from the UtilIdElements table?
Thanks,
Adam
What is the best way to find the classes that extend from another class?
For example, if I want to find all the classes that extend from
SalesTableType, currently, I'm doing this.
==================================================
UtilIdELements utilidelements;
SysDictClass sysdictclass;
;
while select utilidelements
where utilidelements.recordtype == UtilElementType::Class
&& utilidelements.name like 'SalesTableType*'
{
sysdictclass = new SysDictClass(utilidelements.id);
if((sysdictclass != null)
&& !sysdictclass.isAbstract()
&& sysdictclass.isExtending(classnum(SalesTableType)))
{
info(sysdictclass.name());
}
}
==================================================
I'm just curious if there's a better way. I hate doing the while select and
checking for the name, then instantiating the sysdictclass object just to
check if it extends from the class I'm looking for. Also this has a flaw
that there could be classes extending from SalesTableType which do not have a
name like "SalesTableType*". Is there a better way of getting this
information from the UtilIdElements table?
Thanks,
Adam