count Parents
abstract fun countParents(indirectParents: Boolean = false, predicate: (KoParentDeclaration) -> Boolean): Int
Returns the number of parents that satisfies the specified predicate present in the declaration.
Return
The number of parents in the declaration satisfying predicate.
Parameters
indirect Parents
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]
Content copied to clipboard
predicate
The predicate function to determine if a parent satisfies a condition.