Abstract Showability properties behind methods

This allows a follow up change to refactor the implementation of
`Showability` without affecting the callers.

Bug: 292484829
Test: ./gradlew
Change-Id: I0a25cbc197a505d6dcec0b577e72e527442fb7ef
diff --git a/metalava-model/src/main/java/com/android/tools/metalava/model/AnnotationInfo.kt b/metalava-model/src/main/java/com/android/tools/metalava/model/AnnotationInfo.kt
index 80509ce..d2ceee5 100644
--- a/metalava-model/src/main/java/com/android/tools/metalava/model/AnnotationInfo.kt
+++ b/metalava-model/src/main/java/com/android/tools/metalava/model/AnnotationInfo.kt
@@ -76,18 +76,23 @@
      * If true then the annotated item will be shown as part of the API, unless overridden in some
      * way.
      */
-    val show: Boolean,
+    private val show: Boolean,
     /**
      * If true then the annotated item will recursively affect enclosed items, unless overridden by
      * a closer annotation.
      */
-    val recursive: Boolean,
+    private val recursive: Boolean,
     /**
      * If true then the annotated item will only be included in stubs of the API, otherwise it can
      * appear in all representations of the API, e.g. signature files.
      */
-    val forStubsOnly: Boolean,
+    private val forStubsOnly: Boolean,
 ) {
+    fun show() = show
+
+    fun showForStubsOnly() = forStubsOnly
+
+    fun showNonRecursive() = show && !recursive
 
     companion object {
         /** The annotation does not affect whether an annotated item is shown. */
diff --git a/metalava-model/src/main/java/com/android/tools/metalava/model/AnnotationItem.kt b/metalava-model/src/main/java/com/android/tools/metalava/model/AnnotationItem.kt
index 605e5ae..450556c 100644
--- a/metalava-model/src/main/java/com/android/tools/metalava/model/AnnotationItem.kt
+++ b/metalava-model/src/main/java/com/android/tools/metalava/model/AnnotationItem.kt
@@ -295,9 +295,9 @@
             ?.findAnnotation(AnnotationItem::isTypeDefAnnotation)
     }
 
-    override fun isShowAnnotation(): Boolean = info.showability.show
+    override fun isShowAnnotation(): Boolean = info.showability.show()
 
-    override fun isShowForStubPurposes(): Boolean = info.showability.forStubsOnly
+    override fun isShowForStubPurposes(): Boolean = info.showability.showForStubsOnly()
 
     override fun isHideAnnotation(): Boolean = info.hide
 
diff --git a/metalava-model/src/main/java/com/android/tools/metalava/model/Item.kt b/metalava-model/src/main/java/com/android/tools/metalava/model/Item.kt
index ce99a43..21ca1a5 100644
--- a/metalava-model/src/main/java/com/android/tools/metalava/model/Item.kt
+++ b/metalava-model/src/main/java/com/android/tools/metalava/model/Item.kt
@@ -194,14 +194,14 @@
      *
      * See [Showability.show]
      */
-    fun hasShowAnnotation(): Boolean = showability.show
+    fun hasShowAnnotation(): Boolean = showability.show()
 
     /**
      * Returns true if this has any show single annotations.
      *
      * See [Showability.recursive]
      */
-    fun hasShowSingleAnnotation(): Boolean = showability.let { it.show && !it.recursive }
+    fun hasShowSingleAnnotation(): Boolean = showability.showNonRecursive()
 
     /**
      * Returns true if this item has any show for stub purposes annotations and that is the only
@@ -209,7 +209,7 @@
      *
      * See [Showability.forStubsOnly]
      */
-    fun onlyShowForStubPurposes(): Boolean = showability.forStubsOnly
+    fun onlyShowForStubPurposes(): Boolean = showability.showForStubsOnly()
 
     /** Returns true if this modifier list contains any hide annotations */
     fun hasHideAnnotation(): Boolean =