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

com.hp.jipp.model.InsertSheet.kt Maven / Gradle / Ivy

// Copyright 2018 HP Development Company, L.P.
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2019-05-28
@file:Suppress("MaxLineLength", "WildcardImport")

package com.hp.jipp.model

import com.hp.jipp.encoding.* // ktlint-disable no-wildcard-imports

/**
 * Data object corresponding to a "insert-sheet" collection as defined in:
 * [PWG5100.3](https://ftp.pwg.org/pub/pwg/candidates/cs-ippprodprint10-20010212-5100.3.pdf),
 * [RFC8011](http://www.iana.org/go/rfc8011).
 */
@Suppress("RedundantCompanionReference", "unused")
data class InsertSheet
constructor(
    var insertAfterPageNumber: Int? = null,
    var insertCount: Int? = null,
    /** May contain any keyword from [Media] or a name. */
    var media: KeywordOrName? = null,
    var mediaCol: MediaCol? = null
) : AttributeCollection {

    /** Construct an empty [InsertSheet]. */
    constructor() : this(null, null, null, null)

    /** Produce an attribute list from members. */
    override val attributes: List> by lazy {
        listOfNotNull(
            insertAfterPageNumber?.let { Types.insertAfterPageNumber.of(it) },
            insertCount?.let { Types.insertCount.of(it) },
            media?.let { Types.media.of(it) },
            mediaCol?.let { Types.mediaCol.of(it) }
        )
    }

    /** Type for attributes of this collection */
    class Type(override val name: String) : AttributeCollection.Type(InsertSheet)

    /** All member names as strings. */
    object Name {
        /** "insert-after-page-number" member name */
        const val insertAfterPageNumber = "insert-after-page-number"
        /** "insert-count" member name */
        const val insertCount = "insert-count"
        /** "media" member name */
        const val media = "media"
        /** "media-col" member name */
        const val mediaCol = "media-col"
    }

    /** Types for each member attribute. */
    object Types {
        val insertAfterPageNumber = IntType(Name.insertAfterPageNumber)
        val insertCount = IntType(Name.insertCount)
        val media = KeywordOrNameType(Name.media)
        val mediaCol = MediaCol.Type(Name.mediaCol)
    }

    /** Defines types for each member of [InsertSheet] */
    companion object : AttributeCollection.Converter {
        override fun convert(attributes: List>): InsertSheet =
            InsertSheet(
                extractOne(attributes, Types.insertAfterPageNumber),
                extractOne(attributes, Types.insertCount),
                extractOne(attributes, Types.media),
                extractOne(attributes, Types.mediaCol)
            )
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy