Skip to content

Commit e9e6d81

Browse files
committed
feat: add getDefaultPluralFor method
Fixes #6313
1 parent e7a8e1e commit e9e6d81

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* Fix #6886: Remove invalid JUnit 4 references
1010

1111
#### Improvements
12+
13+
* Fix #6313: Add HasMetadata.getDefaultPluralFor method
1214
* Fix #6863: ensuring SerialExecutor does not throw RejectedExecutionException to prevent unnecessary error logs
1315
* Fix #6763: (crd-generator) YAML output customization
1416
* Fix #6880: LogWatch interface provides listeners on close stream event

kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/HasMetadata.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,18 @@ static String getPlural(Class<?> clazz) {
122122
: Pluralize.toPlural(getSingular(clazz)));
123123
}
124124

125+
/**
126+
* Retrieves the default plural form associated with the specified kind. Note that this is a best-effort attempt based on only
127+
* the provided kind and might not correspond to the actual plural form if defined in a different way than the linguistic
128+
* plural derived from the kind.
129+
*
130+
* @param kind the kind which default plural form we want to retrieve
131+
* @return the default plural form associated with the specified kind
132+
*/
133+
static String getDefaultPluralFor(String kind) {
134+
return kind != null ? Pluralize.toPlural(kind.toLowerCase(Locale.ROOT)) : null;
135+
}
136+
125137
/**
126138
* Retrieves the singular form associated with the specified class as defined by the
127139
* {@link Singular} annotation or computes a default value (lower-cased version of the value

0 commit comments

Comments
 (0)