1 /* 2 * Copyright (C) 2018 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.text 18 19 import com.android.tools.metalava.doclava1.SourcePositionInfo 20 import com.android.tools.metalava.doclava1.TextCodebase 21 import com.android.tools.metalava.model.FieldItem 22 import com.android.tools.metalava.model.PropertyItem 23 import com.android.tools.metalava.model.TypeItem 24 25 class TextPropertyItem( 26 codebase: TextCodebase, 27 name: String, 28 containingClass: TextClassItem, 29 modifiers: TextModifiers, 30 private val type: TextTypeItem, 31 position: SourcePositionInfo 32 ) : TextMemberItem(codebase, name, containingClass, position, modifiers), PropertyItem { 33 34 init { 35 modifiers.setOwner(this) 36 } 37 equalsnull38 override fun equals(other: Any?): Boolean { 39 if (this === other) return true 40 if (other !is FieldItem) return false 41 42 if (name() != other.name()) { 43 return false 44 } 45 46 return containingClass() == other.containingClass() 47 } 48 hashCodenull49 override fun hashCode(): Int = name().hashCode() 50 51 override fun type(): TypeItem = type 52 53 override fun toString(): String = "Field ${containingClass().fullName()}.${name()}" 54 }