hasParentWithName

abstract fun hasParentWithName(name: String, vararg names: String, indirectParents: Boolean = false): Boolean

Determines whether the declaration has at least one parent (parent class and parent interfaces) whose name matches any of the specified names.

Return

true if there is a matching declaration, false otherwise.

Parameters

name

the name of the parent to check.

names

the names of the parents to check.

indirectParents

specifies whether to include parents defined in other files such as parent of the parent. If true, it includes only those parents defined within our scope and those used by our declarations. For example:

// Android
class AppCompactActivity: Activity
interface Activity

// Project
class BaseActivity: AppCompactActivity() // parents(indirectParents = true) returns [AppCompactActivity]
class MyActivity: BaseActivity() // parents(indirectParents = true) returns [BaseActivity, AppCompactActivity]

abstract fun hasParentWithName(names: Collection<String>, indirectParents: Boolean = false): Boolean

Determines whether the declaration has at least one parent (parent class and parent interfaces) whose name matches any of the specified names.

Return

true if there is a matching declaration, false otherwise.

Parameters

names

the names of the parents to check.

indirectParents

specifies whether to include parents defined in other files such as parent of the parent. If true, it includes only those parents defined within our scope and those used by our declarations. For example:

// Android
class AppCompactActivity: Activity
interface Activity

// Project
class BaseActivity: AppCompactActivity() // parents(indirectParents = true) returns [AppCompactActivity]
class MyActivity: BaseActivity() // parents(indirectParents = true) returns [BaseActivity, AppCompactActivity]