com.hp.jipp.model.PrintAccuracy.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 "print-accuracy" collection as defined in:
* [PWG5100.21](https://ftp.pwg.org/pub/pwg/candidates/cs-ipp3d11-20190329-5100.21.pdf).
*/
@Suppress("RedundantCompanionReference", "unused")
data class PrintAccuracy
constructor(
/** May contain any keyword from [AccuracyUnit]. */
var accuracyUnits: String? = null,
var xAccuracy: Int? = null,
var yAccuracy: Int? = null,
var zAccuracy: Int? = null
) : AttributeCollection {
/** Construct an empty [PrintAccuracy]. */
constructor() : this(null, null, null, null)
/** Produce an attribute list from members. */
override val attributes: List> by lazy {
listOfNotNull(
accuracyUnits?.let { Types.accuracyUnits.of(it) },
xAccuracy?.let { Types.xAccuracy.of(it) },
yAccuracy?.let { Types.yAccuracy.of(it) },
zAccuracy?.let { Types.zAccuracy.of(it) }
)
}
/** Type for attributes of this collection */
class Type(override val name: String) : AttributeCollection.Type(PrintAccuracy)
/** All member names as strings. */
object Name {
/** "accuracy-units" member name */
const val accuracyUnits = "accuracy-units"
/** "x-accuracy" member name */
const val xAccuracy = "x-accuracy"
/** "y-accuracy" member name */
const val yAccuracy = "y-accuracy"
/** "z-accuracy" member name */
const val zAccuracy = "z-accuracy"
}
/** Types for each member attribute. */
object Types {
val accuracyUnits = KeywordType(Name.accuracyUnits)
val xAccuracy = IntType(Name.xAccuracy)
val yAccuracy = IntType(Name.yAccuracy)
val zAccuracy = IntType(Name.zAccuracy)
}
/** Defines types for each member of [PrintAccuracy] */
companion object : AttributeCollection.Converter {
override fun convert(attributes: List>): PrintAccuracy =
PrintAccuracy(
extractOne(attributes, Types.accuracyUnits),
extractOne(attributes, Types.xAccuracy),
extractOne(attributes, Types.yAccuracy),
extractOne(attributes, Types.zAccuracy)
)
}
}