Class InheritanceLevel

  • All Implemented Interfaces:
    Scalar<Integer>

    public final class InheritanceLevel
    extends Object
    implements Scalar<Integer>
    The number of superclasses between base and derived class.

    This class is thread safe.

    Result interpretation:

    • Integer.MIN_VALUE -> classes are not related. (ex. matching FileNotFoundException with RuntimeException);
    • 0 -> classes are identical. (ex. matching IOException with IOException);
    • 1 -> single level inheritance. (ex. matching FileNotFoundException with IOException);
    • 2 -> two inheritance levels. (ex. matching FileNotFoundException with Exception).
    Since:
    0.30
    • Constructor Detail

      • InheritanceLevel

        public InheritanceLevel​(Class<?> cderived,
                                Class<?> cbase)
        Ctor.
        Parameters:
        cderived - Derived class
        cbase - Base class
    • Method Detail

      • value

        public Integer value()
        Description copied from interface: Scalar
        Convert it to the value.
        Specified by:
        value in interface Scalar<Integer>
        Returns:
        The value