All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gsonpath.adapter.standard.model.GsonModels.kt Maven / Gradle / Ivy

Go to download

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]
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy