has All Parents
abstract fun hasAllParents(indirectParents: Boolean = false, predicate: (KoParentDeclaration) -> Boolean): Boolean
Determines whether the declaration has all parents (parent classes and parent interfaces) that satisfy the provided predicate.
Note that if the parents contains no elements, the function returns true
because there are no elements in it that do not match the predicate.
Return
true
if all parent declarations satisfy the predicate, false
otherwise.
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
A function that defines the condition to be met by parent declarations.