|
| 1 | +/* |
| 2 | +Copyright 2020 The Kubernetes Authors. |
| 3 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +you may not use this file except in compliance with the License. |
| 5 | +You may obtain a copy of the License at |
| 6 | +http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | +Unless required by applicable law or agreed to in writing, software |
| 8 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | +See the License for the specific language governing permissions and |
| 11 | +limitations under the License. |
| 12 | +*/ |
| 13 | +package io.kubernetes.client.common; |
| 14 | + |
| 15 | +import java.util.ArrayList; |
| 16 | +import java.util.List; |
| 17 | +import java.util.Objects; |
| 18 | +import javax.annotation.Nullable; |
| 19 | +import io.kubernetes.client.openapi.models.V1ListMeta; |
| 20 | + |
| 21 | + |
| 22 | +public class PartialObjectMetadataList implements KubernetesListObject { |
| 23 | + private String apiVersion; |
| 24 | + private String kind; |
| 25 | + private V1ListMeta metadata; |
| 26 | + private List<KubernetesObject> items; |
| 27 | + |
| 28 | + |
| 29 | + public PartialObjectMetadataList apiVersion(String apiVersion) { |
| 30 | + this.apiVersion = apiVersion; |
| 31 | + return this; |
| 32 | + } |
| 33 | + |
| 34 | + @Override |
| 35 | + @Nullable |
| 36 | + public String getApiVersion() { |
| 37 | + return apiVersion; |
| 38 | + } |
| 39 | + |
| 40 | + public void setApiVersion(String apiVersion) { |
| 41 | + this.apiVersion = apiVersion; |
| 42 | + } |
| 43 | + |
| 44 | + public PartialObjectMetadataList kind(String kind) { |
| 45 | + this.kind = kind; |
| 46 | + return this; |
| 47 | + } |
| 48 | + |
| 49 | + @Override |
| 50 | + @Nullable |
| 51 | + public String getKind() { |
| 52 | + return kind; |
| 53 | + } |
| 54 | + |
| 55 | + public void setKind(String kind) { |
| 56 | + this.kind = kind; |
| 57 | + } |
| 58 | + |
| 59 | + public PartialObjectMetadataList metadata(V1ListMeta metadata) { |
| 60 | + this.metadata = metadata; |
| 61 | + return this; |
| 62 | + } |
| 63 | + |
| 64 | + @Override |
| 65 | + @Nullable |
| 66 | + public V1ListMeta getMetadata() { |
| 67 | + return metadata; |
| 68 | + } |
| 69 | + |
| 70 | + public void setMetadata(V1ListMeta metadata) { |
| 71 | + this.metadata = metadata; |
| 72 | + } |
| 73 | + |
| 74 | + @SuppressWarnings("unchecked") |
| 75 | + public PartialObjectMetadataList items(List<? extends KubernetesObject> items) { |
| 76 | + this.items = (List<KubernetesObject>) items; |
| 77 | + return this; |
| 78 | + } |
| 79 | + |
| 80 | + public PartialObjectMetadataList addItemsItem(KubernetesObject item) { |
| 81 | + if (items == null) { |
| 82 | + items = new ArrayList<>(); |
| 83 | + } |
| 84 | + items.add(item); |
| 85 | + return this; |
| 86 | + } |
| 87 | + |
| 88 | + @Override |
| 89 | + @Nullable |
| 90 | + public List<? extends KubernetesObject> getItems() { |
| 91 | + return items; |
| 92 | + } |
| 93 | + |
| 94 | + @SuppressWarnings("unchecked") |
| 95 | + public void setItems(List<? extends KubernetesObject> items) { |
| 96 | + this.items = (List<KubernetesObject>) items; |
| 97 | + } |
| 98 | + |
| 99 | + @Override |
| 100 | + public boolean equals(java.lang.Object o) { |
| 101 | + if (this == o) { |
| 102 | + return true; |
| 103 | + } |
| 104 | + if (o == null || getClass() != o.getClass()) { |
| 105 | + return false; |
| 106 | + } |
| 107 | + PartialObjectMetadataList other = (PartialObjectMetadataList) o; |
| 108 | + return Objects.equals(this.apiVersion, other.apiVersion) |
| 109 | + && Objects.equals(this.kind, other.kind) |
| 110 | + && Objects.equals(this.metadata, other.metadata) |
| 111 | + && Objects.equals(this.items, other.items); |
| 112 | + } |
| 113 | + |
| 114 | + @Override |
| 115 | + public int hashCode() { |
| 116 | + return Objects.hash(apiVersion, kind, metadata, items); |
| 117 | + } |
| 118 | + |
| 119 | + @Override |
| 120 | + public String toString() { |
| 121 | + StringBuilder sb = new StringBuilder(); |
| 122 | + sb.append("class PartialObjectMetadataList {\n"); |
| 123 | + sb.append(" apiVersion: ").append(toIndentedString(apiVersion)).append("\n"); |
| 124 | + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); |
| 125 | + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); |
| 126 | + sb.append(" items: ").append(toIndentedString(items)).append("\n"); |
| 127 | + sb.append("}"); |
| 128 | + return sb.toString(); |
| 129 | + } |
| 130 | + |
| 131 | + /** |
| 132 | + * Convert the given object to string with each line indented by 4 spaces (except the first line). |
| 133 | + */ |
| 134 | + private String toIndentedString(java.lang.Object o) { |
| 135 | + if (o == null) { |
| 136 | + return "null"; |
| 137 | + } |
| 138 | + return o.toString().replace("\n", "\n "); |
| 139 | + } |
| 140 | +} |
0 commit comments