gsonpath.adapter.standard.model.GsonModels.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gsonpath-compiler Show documentation
Show all versions of gsonpath-compiler Show documentation
An annotation processor which generates Type Adapters for the Google Gson library
The newest version!
package gsonpath.adapter.standard.model
import gsonpath.model.FieldInfo
sealed class GsonModel
sealed class GsonArrayElement : GsonModel()
data class GsonField(
val fieldIndex: Int,
val fieldInfo: FieldInfo,
val variableName: String,
val jsonPath: String,
val isRequired: Boolean) : GsonArrayElement()
data class GsonObject(private val fieldMap: Map) : GsonArrayElement() {
fun entries(): Set> {
return fieldMap.entries
}
fun size(): Int {
return fieldMap.size
}
}
data class GsonArray(
private val arrayFields: Map = HashMap(),
val maxIndex: Int) : GsonModel() {
fun entries(): Set> {
return arrayFields.entries
}
operator fun get(arrayIndex: Int): GsonArrayElement? {
return arrayFields[arrayIndex]
}
}