Skip to content

Commit 5eccf41

Browse files
committed
regenerate from k8s 1.28 using v4.3.1 generator
Signed-off-by: Min Jin <[email protected]>
1 parent 022b9ab commit 5eccf41

File tree

2,344 files changed

+172954
-171636
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,344 files changed

+172954
-171636
lines changed
Lines changed: 43 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,128 +1,79 @@
11
package io.kubernetes.client.fluent;
22

33
import java.util.LinkedHashSet;
4-
import java.util.Map.Entry;
54
import java.util.stream.Collectors;
65
import java.util.Set;
6+
import java.util.Optional;
77
import java.util.ArrayList;
8-
import java.lang.String;
9-
import java.util.AbstractMap;
108
import java.util.Objects;
11-
import java.lang.Class;
129
import java.lang.Object;
1310
import java.util.List;
11+
import java.lang.String;
1412
import java.util.Arrays;
15-
import java.util.Collections;
16-
public class BaseFluent<F extends Fluent<F>> implements Fluent<F>,Visitable<F>{
13+
public class BaseFluent<F>{
14+
1715
public static final String VISIT = "visit";
1816
public final VisitableMap _visitables = new VisitableMap();
17+
1918
public static <T>VisitableBuilder<T,?> builderOf(T item) {
2019
if (item instanceof Editable) {
21-
Object editor = ((Editable) item).edit();
22-
if (editor instanceof VisitableBuilder) {
23-
return (VisitableBuilder<T, ?>) editor;
24-
}
25-
}
26-
27-
try {
28-
return (VisitableBuilder<T, ?>) Class.forName(item.getClass().getName() + "Builder", true, item.getClass().getClassLoader()).getConstructor(item.getClass())
29-
.newInstance(item);
30-
} catch (Exception e) {
31-
try {
32-
return (VisitableBuilder<T, ?>) Class.forName(item.getClass().getName() + "Builder").getConstructor(item.getClass())
33-
.newInstance(item);
34-
} catch (Exception e1) {
35-
throw new IllegalStateException("Failed to create builder for: " + item.getClass(), e1);
36-
}
37-
}
20+
Object editor = ((Editable) item).edit();
21+
if (editor instanceof VisitableBuilder) {
22+
return (VisitableBuilder<T, ?>) editor;
23+
}
24+
}
25+
26+
try {
27+
return (VisitableBuilder<T, ?>) Class
28+
.forName(item.getClass().getName() + "Builder", true, item.getClass().getClassLoader())
29+
.getConstructor(item.getClass())
30+
.newInstance(item);
31+
} catch (Exception e) {
32+
try {
33+
return (VisitableBuilder<T, ?>) Class.forName(item.getClass().getName() + "Builder").getConstructor(item.getClass())
34+
.newInstance(item);
35+
} catch (Exception e1) {
36+
throw new IllegalStateException("Failed to create builder for: " + item.getClass(), e1);
37+
}
38+
}
3839
}
40+
3941
public static <T>List<T> build(List<? extends io.kubernetes.client.fluent.Builder<? extends T>> list) {
4042
return list == null ? null : list.stream().map(Builder::build).collect(Collectors.toList());
4143
}
44+
4245
public static <T>Set<T> build(Set<? extends io.kubernetes.client.fluent.Builder<? extends T>> set) {
4346
return set == null ? null : new LinkedHashSet<T>(set.stream().map(Builder::build).collect(Collectors.toSet()));
4447
}
48+
4549
public static <T>List<T> aggregate(List<? extends T>... lists) {
4650
return new ArrayList(Arrays.stream(lists).filter(Objects::nonNull).collect(Collectors.toList()));
4751
}
52+
4853
public static <T>Set<T> aggregate(Set<? extends T>... sets) {
4954
return new LinkedHashSet(Arrays.stream(sets).filter(Objects::nonNull).collect(Collectors.toSet()));
5055
}
51-
public F accept(io.kubernetes.client.fluent.Visitor... visitors) {
52-
return accept(Collections.emptyList(), visitors);
53-
}
54-
public <V>F accept(Class<V> type,Visitor<V> visitor) {
55-
return accept(Collections.emptyList(), new Visitor<V>() {
56-
@Override
57-
public Class<V> getType() {
58-
return type;
59-
}
60-
61-
@Override
62-
public void visit(List<Entry<String, Object>> path, V element) {
63-
visitor.visit(path, element);
64-
}
65-
66-
@Override
67-
public void visit(V element) {
68-
visitor.visit(element);
69-
}
70-
});
71-
}
72-
public F accept(List<Entry<String,Object>> path,io.kubernetes.client.fluent.Visitor... visitors) {
73-
return accept(path, "", visitors);
74-
}
75-
public F accept(List<Entry<String,Object>> path,String currentKey,io.kubernetes.client.fluent.Visitor... visitors) {
76-
List<Visitor> sortedVisitor = new ArrayList<>();
77-
for (Visitor visitor : visitors) {
78-
visitor = VisitorListener.wrap(visitor);
79-
if (!visitor.canVisit(path, this)) {
80-
continue;
81-
}
82-
sortedVisitor.add(visitor);
83-
}
84-
sortedVisitor.sort((l, r) -> ((Visitor) r).order() - ((Visitor) l).order());
85-
for (Visitor visitor : sortedVisitor) {
86-
visitor.visit(path, this);
87-
}
88-
89-
List<Entry<String, Object>> copyOfPath = path != null ? new ArrayList(path) : new ArrayList<>();
90-
copyOfPath.add(new AbstractMap.SimpleEntry<>(currentKey, this));
91-
92-
for (Entry<String, ?> entry : _visitables.entrySet()) {
93-
List<Entry<String, Object>> newPath = Collections.unmodifiableList(copyOfPath);
94-
95-
// Copy visitables to avoid ConcurrentModificationException when Visitors add/remove Visitables
96-
for (Visitable<F> visitable : new ArrayList<>((List<Visitable<F>>) entry.getValue())) {
97-
for (Visitor visitor : visitors) {
98-
if (visitor.getType() != null && visitor.getType().isAssignableFrom(visitable.getClass())) {
99-
visitable.accept(newPath, entry.getKey(), visitor);
100-
}
101-
}
102-
103-
for (Visitor visitor : visitors) {
104-
if (visitor.getType() == null || !visitor.getType().isAssignableFrom(visitable.getClass())) {
105-
visitable.accept(newPath, entry.getKey(), visitor);
106-
}
107-
}
108-
}
109-
}
110-
return (F) this;
56+
57+
public Optional<VisitableMap> getVisitableMap() {
58+
return Optional.of(_visitables);
11159
}
60+
11261
public int hashCode() {
11362
final int prime = 31;
114-
int result = 1;
115-
result = prime * result + 0;
116-
return result;
63+
int result = 1;
64+
result = prime * result + 0;
65+
return result;
11766
}
67+
11868
public boolean equals(Object obj) {
11969
if (this == obj)
120-
return true;
121-
if (obj == null)
122-
return false;
123-
if (getClass() != obj.getClass())
124-
return false;
125-
return true;
70+
return true;
71+
if (obj == null)
72+
return false;
73+
if (getClass() != obj.getClass())
74+
return false;
75+
return true;
12676
}
12777

78+
12879
}
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package io.kubernetes.client.fluent;
22

33
import java.lang.FunctionalInterface;
4-
@FunctionalInterface
5-
public interface Builder<T>{
4+
@FunctionalInterface
5+
public interface Builder<T>{
6+
7+
68
T build();
79

10+
811
}

fluent/src/main/java/io/kubernetes/client/fluent/DelegatingVisitor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,30 @@
99
public class DelegatingVisitor<T> implements Visitor<T>{
1010
DelegatingVisitor(Class<T> type,Visitor<T> delegate) {
1111
this.type = type;
12-
this.delegate = delegate;
12+
this.delegate = delegate;
1313
}
1414
private final Class<T> type;
1515
private final Visitor<T> delegate;
16+
1617
public Class<T> getType() {
1718
return type;
1819
}
20+
1921
public void visit(T target) {
2022
delegate.visit(target);
2123
}
24+
2225
public int order() {
2326
return delegate.order();
2427
}
28+
2529
public void visit(List<Entry<String,Object>> path,T target) {
2630
delegate.visit(path, target);
2731
}
32+
2833
public <F>Predicate<List<Entry<String,Object>>> getRequirement() {
2934
return delegate.getRequirement();
3035
}
3136

37+
3238
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package io.kubernetes.client.fluent;
22

33
public interface Editable<T>{
4+
5+
46
T edit();
57

8+
69
}

fluent/src/main/java/io/kubernetes/client/fluent/Fluent.java

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package io.kubernetes.client.fluent;
22

33
public interface Nested<F>{
4+
5+
46
F and();
57

8+
69
}

fluent/src/main/java/io/kubernetes/client/fluent/PathAwareTypedVisitor.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,30 @@
99
public class PathAwareTypedVisitor<V,P> extends TypedVisitor<V>{
1010
PathAwareTypedVisitor() {
1111
List<Class> args = Visitors.getTypeArguments(PathAwareTypedVisitor.class, getClass());
12-
if (args == null || args.isEmpty()) {
13-
throw new IllegalStateException("Could not determine type arguments for path aware typed visitor.");
14-
}
15-
this.type = (Class<V>) args.get(0);
16-
this.parentType = (Class<P>) args.get(1);
12+
if (args == null || args.isEmpty()) {
13+
throw new IllegalStateException("Could not determine type arguments for path aware typed visitor.");
14+
}
15+
this.type = (Class<V>) args.get(0);
16+
this.parentType = (Class<P>) args.get(1);
1717
}
1818
private final Class<V> type;
1919
private final Class<P> parentType;
20+
2021
public void visit(V element) {
2122

2223
}
24+
2325
public void visit(List<Entry<String,Object>> path,V element) {
2426
visit(element);
2527
}
28+
2629
public P getParent(List<Entry<String,Object>> path) {
2730
return path.size() - 1 >= 0 ? (P) path.get(path.size() - 1) : null;
2831
}
32+
2933
public Class<P> getParentType() {
3034
return parentType;
3135
}
3236

37+
3338
}

fluent/src/main/java/io/kubernetes/client/fluent/TypedVisitor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
import java.lang.Class;
44
public abstract class TypedVisitor<V> implements Visitor<V>{
5+
6+
7+
58
public Class<V> getType() {
69
return (Class<V>) Visitors.getTypeArguments(TypedVisitor.class, getClass()).get(0);
710
}
811

12+
913
}

0 commit comments

Comments
 (0)