Home | History | Annotate | Download | only in visitors
      1 /*
      2  * Copyright (C) 2017 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.tools.metalava.model.visitors
     18 
     19 import com.android.tools.metalava.model.Item
     20 
     21 // TODO: Use ApiVisitor instead!
     22 open class VisibleItemVisitor(
     23     /**
     24      * Whether constructors should be visited as part of a [#visitMethod] call
     25      * instead of just a [#visitConstructor] call. Helps simplify visitors that
     26      * don't care to distinguish between the two cases. Defaults to true.
     27      */
     28     visitConstructorsAsMethods: Boolean = true,
     29     /**
     30      * Whether inner classes should be visited "inside" a class; when this property
     31      * is true, inner classes are visited before the [#afterVisitClass] method is
     32      * called; when false, it's done afterwards. Defaults to false.
     33      */
     34     nestInnerClasses: Boolean = false
     35 ) : ItemVisitor(visitConstructorsAsMethods, nestInnerClasses) {
     36     override fun skip(item: Item): Boolean {
     37         return !item.included
     38     }
     39 }