io.alauda.kubernetes.api.model.KubernetesList Maven / Gradle / Ivy
/**
* Copyright (C) 2018 Alauda, Inc.
*
* 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.alauda.kubernetes.api.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.alauda.kubernetes.internal.HasMetadataComparator;
import io.sundr.builder.annotations.Buildable;
import io.sundr.builder.annotations.Inline;
import javax.annotation.Generated;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
*
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@Generated("org.jsonschema2pojo")
@JsonPropertyOrder({
"apiVersion",
"kind",
"metadata",
"items",
})
@JsonDeserialize(using = JsonDeserializer.None.class)
@Buildable(editableEnabled = false, validationEnabled = true, generateBuilderPackage=true, builderPackage = "io.alauda.kubernetes.api.builder", inline = @Inline(type = Doneable.class, prefix = "Doneable", value = "done"))
public class KubernetesList extends BaseKubernetesList implements KubernetesResource {
/**
* No args constructor for use in serialization
*/
public KubernetesList() {
super();
}
public KubernetesList(String apiVersion,
List items,
String kind,
ListMeta metadata) {
super(apiVersion, items, kind, metadata);
}
@Override
public List getItems() {
List sortedItems = new ArrayList<>(super.getItems());
Collections.sort(sortedItems, new HasMetadataComparator());
return sortedItems;
}
}