Skip to content

Commit 6df2236

Browse files
committed
Implement StructElement by delegation
1 parent 20cf605 commit 6df2236

File tree

1 file changed

+1
-54
lines changed

1 file changed

+1
-54
lines changed

app/src/main/java/com/tughi/aggregator/ion/CustomElement.kt

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,18 @@
11
package com.tughi.aggregator.ion
22

3-
import com.amazon.ion.IonWriter
4-
import com.amazon.ionelement.api.AnyElement
53
import com.amazon.ionelement.api.ElementType
64
import com.amazon.ionelement.api.IonElement
7-
import com.amazon.ionelement.api.MetaContainer
85
import com.amazon.ionelement.api.StructElement
9-
import com.amazon.ionelement.api.StructField
106
import com.amazon.ionelement.api.location
117
import com.amazon.ionelement.api.locationToString
128

13-
abstract class CustomElement internal constructor(private val structElement: StructElement, validate: Boolean) : StructElement {
9+
abstract class CustomElement internal constructor(structElement: StructElement, validate: Boolean) : StructElement by structElement {
1410
init {
1511
if (validate) {
1612
validate()
1713
}
1814
}
1915

20-
override val annotations: List<String>
21-
get() = structElement.annotations
22-
23-
override val fields: Collection<StructField>
24-
get() = structElement.fields
25-
26-
override val isNull: Boolean
27-
get() = structElement.isNull
28-
29-
override val metas: MetaContainer
30-
get() = structElement.metas
31-
32-
override val size: Int
33-
get() = structElement.size
34-
35-
override val type: ElementType
36-
get() = structElement.type
37-
38-
override val values: Collection<AnyElement>
39-
get() = structElement.values
40-
41-
override fun asAnyElement() = structElement.asAnyElement()
42-
43-
override fun containsField(fieldName: String) = structElement.containsField(fieldName)
44-
45-
override fun copy(annotations: List<String>, metas: MetaContainer) = structElement.copy(annotations, metas)
46-
47-
override fun get(fieldName: String) = structElement.get(fieldName)
48-
49-
override fun getAll(fieldName: String) = structElement.getAll(fieldName)
50-
51-
override fun getOptional(fieldName: String) = structElement.getOptional(fieldName)
52-
53-
override fun toString() = structElement.toString()
54-
55-
override fun withAnnotations(vararg additionalAnnotations: String) = structElement.withAnnotations(*additionalAnnotations)
56-
57-
override fun withAnnotations(additionalAnnotations: Iterable<String>) = structElement.withAnnotations(additionalAnnotations)
58-
59-
override fun withMeta(key: String, value: Any) = structElement.withMeta(key, value)
60-
61-
override fun withMetas(additionalMetas: MetaContainer) = structElement.withMetas(additionalMetas)
62-
63-
override fun withoutAnnotations() = structElement.withoutAnnotations()
64-
65-
override fun withoutMetas() = structElement.withoutMetas()
66-
67-
override fun writeTo(writer: IonWriter) = structElement.writeTo(writer)
68-
6916
abstract fun validate()
7017

7118
protected fun checkAnnotation(annotation: String) {

0 commit comments

Comments
 (0)