|
20 | 20 | package com.linkedplanet.kotlininsightclient.api.model |
21 | 21 |
|
22 | 22 | import io.swagger.v3.oas.annotations.media.Schema |
23 | | -import javax.validation.constraints.NotNull |
24 | 23 | import java.time.LocalDate |
25 | 24 | import java.time.LocalTime |
26 | 25 | import java.time.ZonedDateTime |
27 | 26 | import java.util.Collections.emptyList |
| 27 | +import javax.validation.constraints.NotNull |
28 | 28 |
|
29 | 29 | // region ID wrapper |
30 | 30 |
|
@@ -123,31 +123,31 @@ sealed class InsightAttribute( |
123 | 123 | @field:NotNull val attributeId: InsightAttributeId, |
124 | 124 | val schema: ObjectTypeSchemaAttribute? |
125 | 125 | ) { |
126 | | - fun isValueAttribute(): Boolean = when(this){ |
127 | | - is Text -> true |
128 | | - is Integer -> true |
129 | | - is Bool -> true |
130 | | - is DoubleNumber -> true |
131 | | - is Select -> true |
132 | | - is Date -> true |
133 | | - is Time -> true |
134 | | - is DateTime -> true |
135 | | - is Url -> true |
136 | | - is Email -> true |
137 | | - is Textarea -> true |
138 | | - is Ipaddress -> true |
139 | | - |
140 | | - is Unknown -> false |
141 | | - is Reference -> false |
142 | | - is User -> false |
143 | | - is Confluence -> false |
144 | | - is Group -> false |
145 | | - is Version -> false |
146 | | - is Project -> false |
147 | | - is Status -> false |
| 126 | + val isValueAttribute: Boolean by lazy { |
| 127 | + when (this) { |
| 128 | + is Text -> true |
| 129 | + is Integer -> true |
| 130 | + is Bool -> true |
| 131 | + is DoubleNumber -> true |
| 132 | + is Select -> true |
| 133 | + is Date -> true |
| 134 | + is Time -> true |
| 135 | + is DateTime -> true |
| 136 | + is Url -> true |
| 137 | + is Email -> true |
| 138 | + is Textarea -> true |
| 139 | + is Ipaddress -> true |
| 140 | + |
| 141 | + is Unknown -> false |
| 142 | + is Reference -> false |
| 143 | + is User -> false |
| 144 | + is Confluence -> false |
| 145 | + is Group -> false |
| 146 | + is Version -> false |
| 147 | + is Project -> false |
| 148 | + is Status -> false |
| 149 | + } |
148 | 150 | } |
149 | | - fun isReference() : Boolean = this is Reference |
150 | | - |
151 | 151 |
|
152 | 152 | class Text(attributeId: InsightAttributeId, val value: String?, schema: ObjectTypeSchemaAttribute?) : InsightAttribute(attributeId, schema) |
153 | 153 | class Integer(attributeId: InsightAttributeId,val value: Int?, schema: ObjectTypeSchemaAttribute?) : InsightAttribute(attributeId, schema) |
@@ -303,32 +303,32 @@ sealed class ObjectTypeSchemaAttribute( |
303 | 303 | @field:NotNull val includeChildObjectTypes: Boolean |
304 | 304 | ) { |
305 | 305 |
|
306 | | - fun isValueAttribute(): Boolean = when(this){ |
307 | | - is TextSchema -> true |
308 | | - is IntegerSchema -> true |
309 | | - is BoolSchema -> true |
310 | | - is DoubleNumberSchema -> true |
311 | | - is SelectSchema -> true |
312 | | - is DateSchema -> true |
313 | | - is TimeSchema -> true |
314 | | - is DateTimeSchema -> true |
315 | | - is UrlSchema -> true |
316 | | - is EmailSchema -> true |
317 | | - is TextareaSchema -> true |
318 | | - is IpaddressSchema -> true |
319 | | - |
320 | | - is UnknownSchema -> false |
321 | | - is ReferenceSchema -> false |
322 | | - is UserSchema -> false |
323 | | - is ConfluenceSchema -> false |
324 | | - is GroupSchema -> false |
325 | | - is VersionSchema -> false |
326 | | - is ProjectSchema -> false |
327 | | - is StatusSchema -> false |
| 306 | + val isValueAttribute: Boolean by lazy { |
| 307 | + when(this){ |
| 308 | + is TextSchema -> true |
| 309 | + is IntegerSchema -> true |
| 310 | + is BoolSchema -> true |
| 311 | + is DoubleNumberSchema -> true |
| 312 | + is SelectSchema -> true |
| 313 | + is DateSchema -> true |
| 314 | + is TimeSchema -> true |
| 315 | + is DateTimeSchema -> true |
| 316 | + is UrlSchema -> true |
| 317 | + is EmailSchema -> true |
| 318 | + is TextareaSchema -> true |
| 319 | + is IpaddressSchema -> true |
| 320 | + |
| 321 | + is UnknownSchema -> false |
| 322 | + is ReferenceSchema -> false |
| 323 | + is UserSchema -> false |
| 324 | + is ConfluenceSchema -> false |
| 325 | + is GroupSchema -> false |
| 326 | + is VersionSchema -> false |
| 327 | + is ProjectSchema -> false |
| 328 | + is StatusSchema -> false |
| 329 | + } |
328 | 330 | } |
329 | 331 |
|
330 | | - fun isReference() : Boolean = this is ReferenceSchema |
331 | | - |
332 | 332 | class SelectSchema( |
333 | 333 | id: InsightAttributeId, |
334 | 334 | name: String, |
|
0 commit comments