CMS Snapshot Analysis - Run Analyzer - J2EE - Information - How to find out the list of ancestors of a class

Description

Ancestors can be interfaces implemented by the class, or parent classes extended by the class. This page explains how to list the ancestors of a class.

Applicable in CAST Version

 

Release
Yes/No
8.3.xN/A
Applicable RDBMS
RDBMS
Yes/No
CSSN/A
How to find out the list of ancestors of a class

HOW To find out the list of ancestors of a class

Open the source file and look if the class implements some interface. It is the case if the class declaration contains the implements keyword

Interface Implementation
class Child implements IChild, ISomeOtherInterface {

In this example, class Child implements two interfaces : IChild and ISomeOtherInterface. Add both interfaces to your list.

If the class inherits some parent class, then you also have to find out the interfaces implemented by the parent class.
The class inherits a parent class if the class declaration contains the extends keyword.

Class Inheritance
class Child extends Parent implements IChild, ISomeOtherInterface {

In this example, add class Parent and interfaces IChild and ISomeOtherInterface to your list.


To find out the location of the Parent source file, look for it in Enlighten Object Browser and add it to your view. Typing F12 will tell you about the source file in the properties view
Example:

Interface Implementation (parent class source file)
class Parent implements IParentInterface {

In this example, add interface IChildParentInterface to your list.

Of course, if interface IParentInterface extends another interface like below, you have to proceed recursively until you encounter no more "implements" nor "extends" keywords

Recursive Inheritance
interface IParentInterface extends IGrandParentInterface { 

Add interface IGrandParentInterface to your list


At this stage, your list contains {Child, IChild, ISomeOtherInterface, Parent, IParentInterface, IGrandParentInterface} . To be continued recursively.

Related Pages