io.yupiik.kubernetes.bindings.v1_22_10.v1.CustomResourceDefinitionNames Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2022 - Yupiik SAS - https://www.yupiik.com
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package io.yupiik.kubernetes.bindings.v1_22_10.v1;
import io.yupiik.kubernetes.bindings.v1_22_10.Exportable;
import io.yupiik.kubernetes.bindings.v1_22_10.JsonStrings;
import io.yupiik.kubernetes.bindings.v1_22_10.Validable;
import io.yupiik.kubernetes.bindings.v1_22_10.ValidationException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Stream;
import static java.util.stream.Collectors.joining;
public class CustomResourceDefinitionNames implements Validable, Exportable {
private List categories;
private String kind;
private String listKind;
private String plural;
private List shortNames;
private String singular;
public CustomResourceDefinitionNames() {
// no-op
}
public CustomResourceDefinitionNames(final List categories,
final String kind,
final String listKind,
final String plural,
final List shortNames,
final String singular) {
this.categories = categories;
this.kind = kind;
this.listKind = listKind;
this.plural = plural;
this.shortNames = shortNames;
this.singular = singular;
}
public List getCategories() {
return categories;
}
public void setCategories(final List categories) {
this.categories = categories;
}
public String getKind() {
return kind;
}
public void setKind(final String kind) {
this.kind = kind;
}
public String getListKind() {
return listKind;
}
public void setListKind(final String listKind) {
this.listKind = listKind;
}
public String getPlural() {
return plural;
}
public void setPlural(final String plural) {
this.plural = plural;
}
public List getShortNames() {
return shortNames;
}
public void setShortNames(final List shortNames) {
this.shortNames = shortNames;
}
public String getSingular() {
return singular;
}
public void setSingular(final String singular) {
this.singular = singular;
}
@Override
public int hashCode() {
return Objects.hash(
categories,
kind,
listKind,
plural,
shortNames,
singular);
}
@Override
public boolean equals(final Object __other) {
if (!(__other instanceof CustomResourceDefinitionNames)) {
return false;
}
final CustomResourceDefinitionNames __otherCasted = (CustomResourceDefinitionNames) __other;
return Objects.equals(categories, __otherCasted.categories) &&
Objects.equals(kind, __otherCasted.kind) &&
Objects.equals(listKind, __otherCasted.listKind) &&
Objects.equals(plural, __otherCasted.plural) &&
Objects.equals(shortNames, __otherCasted.shortNames) &&
Objects.equals(singular, __otherCasted.singular);
}
public CustomResourceDefinitionNames categories(final List categories) {
this.categories = categories;
return this;
}
public CustomResourceDefinitionNames kind(final String kind) {
this.kind = kind;
return this;
}
public CustomResourceDefinitionNames listKind(final String listKind) {
this.listKind = listKind;
return this;
}
public CustomResourceDefinitionNames plural(final String plural) {
this.plural = plural;
return this;
}
public CustomResourceDefinitionNames shortNames(final List shortNames) {
this.shortNames = shortNames;
return this;
}
public CustomResourceDefinitionNames singular(final String singular) {
this.singular = singular;
return this;
}
@Override
public CustomResourceDefinitionNames validate() {
List __errors_jsonSchema = null;
if (kind == null) {
if (__errors_jsonSchema == null) {
__errors_jsonSchema = new ArrayList<>();
}
__errors_jsonSchema.add(new ValidationException.ValidationError(
"kind", "kind",
"Missing 'kind' attribute.", true));
}
if (plural == null) {
if (__errors_jsonSchema == null) {
__errors_jsonSchema = new ArrayList<>();
}
__errors_jsonSchema.add(new ValidationException.ValidationError(
"plural", "plural",
"Missing 'plural' attribute.", true));
}
if (__errors_jsonSchema != null) {
throw new ValidationException(__errors_jsonSchema);
}
return this;
}
@Override
public String asJson() {
return Stream.of(
(categories != null ? "\"categories\":" + categories.stream().map(__it -> __it == null ? "null" : ("\"" + JsonStrings.escapeJson(__it) + "\"")).collect(joining(",", "[", "]")) : ""),
(kind != null ? "\"kind\":\"" + JsonStrings.escapeJson(kind) + "\"" : ""),
(listKind != null ? "\"listKind\":\"" + JsonStrings.escapeJson(listKind) + "\"" : ""),
(plural != null ? "\"plural\":\"" + JsonStrings.escapeJson(plural) + "\"" : ""),
(shortNames != null ? "\"shortNames\":" + shortNames.stream().map(__it -> __it == null ? "null" : ("\"" + JsonStrings.escapeJson(__it) + "\"")).collect(joining(",", "[", "]")) : ""),
(singular != null ? "\"singular\":\"" + JsonStrings.escapeJson(singular) + "\"" : ""))
.filter(__it -> !__it.isBlank())
.collect(joining(",", "{", "}"));
}
}