R/non_empty_domain.R

# TileDB Storage Platform API
#
# TileDB Storage Platform REST API
#
# The version of the OpenAPI document: 2.2.19
# 
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title NonEmptyDomain
#'
#' @description NonEmptyDomain Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field nonEmptyDomain  \link{DomainArray} 
#'
#' @field isEmpty  character 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
NonEmptyDomain <- R6::R6Class(
  'NonEmptyDomain',
  public = list(
    `nonEmptyDomain` = NULL,
    `isEmpty` = NULL,
    initialize = function(
        `nonEmptyDomain`, `isEmpty`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`nonEmptyDomain`)) {
        stopifnot(R6::is.R6(`nonEmptyDomain`))
        self$`nonEmptyDomain` <- `nonEmptyDomain`
      }
      if (!missing(`isEmpty`)) {
        self$`isEmpty` <- `isEmpty`
      }
    },
    toJSON = function() {
      NonEmptyDomainObject <- list()
      if (!is.null(self$`nonEmptyDomain`)) {
        NonEmptyDomainObject[['nonEmptyDomain']] <-
          self$`nonEmptyDomain`$toJSON()
      }
      if (!is.null(self$`isEmpty`)) {
        NonEmptyDomainObject[['isEmpty']] <-
          self$`isEmpty`
      }

      NonEmptyDomainObject
    },
    fromJSON = function(NonEmptyDomainJson) {
      NonEmptyDomainObject <- jsonlite::fromJSON(NonEmptyDomainJson)
      if (!is.null(NonEmptyDomainObject$`nonEmptyDomain`)) {
        nonEmptyDomainObject <- DomainArray$new()
        nonEmptyDomainObject$fromJSON(jsonlite::toJSON(NonEmptyDomainObject$nonEmptyDomain, auto_unbox = TRUE, digits = NA))
        self$`nonEmptyDomain` <- nonEmptyDomainObject
      }
      if (!is.null(NonEmptyDomainObject$`isEmpty`)) {
        self$`isEmpty` <- NonEmptyDomainObject$`isEmpty`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`nonEmptyDomain`)) {
        sprintf(
        '"nonEmptyDomain":
        %s
        ',
        jsonlite::toJSON(self$`nonEmptyDomain`$toJSON(), auto_unbox=TRUE, digits = NA)
        )},
        if (!is.null(self$`isEmpty`)) {
        sprintf(
        '"isEmpty":
          "%s"
                ',
        self$`isEmpty`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(NonEmptyDomainJson) {
      NonEmptyDomainObject <- jsonlite::fromJSON(NonEmptyDomainJson)
      self$`nonEmptyDomain` <- DomainArray$new()$fromJSON(jsonlite::toJSON(NonEmptyDomainObject$nonEmptyDomain, auto_unbox = TRUE, digits = NA))
      self$`isEmpty` <- NonEmptyDomainObject$`isEmpty`
      self
    }
  )
)
eddelbuettel/tldbclr documentation built on Sept. 25, 2022, 12:46 p.m.