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 androidx.lifecycle
18 
19 import javax.annotation.processing.AbstractProcessor
20 import javax.annotation.processing.RoundEnvironment
21 import javax.annotation.processing.SupportedAnnotationTypes
22 import javax.lang.model.SourceVersion
23 import javax.lang.model.element.TypeElement
24 
25 @SupportedAnnotationTypes("androidx.lifecycle.OnLifecycleEvent")
26 class LifecycleProcessor : AbstractProcessor() {
processnull27     override fun process(
28         annotations: MutableSet<out TypeElement>,
29         roundEnv: RoundEnvironment
30     ): Boolean {
31         val input = collectAndVerifyInput(processingEnv, roundEnv)
32         writeModels(transformToOutput(processingEnv, input), processingEnv)
33         return true
34     }
35 
getSupportedSourceVersionnull36     override fun getSupportedSourceVersion(): SourceVersion {
37         return SourceVersion.latest()
38     }
39 }
40