use of io.strimzi.crdgenerator.annotations.Type in project strimzi by strimzi.
the class CrdGenerator method buildAdditionalPrinterColumns.
private ArrayNode buildAdditionalPrinterColumns(Crd.Spec crd, ApiVersion crApiVersion) {
ArrayNode cols = nf.arrayNode();
if (crd.additionalPrinterColumns().length != 0) {
for (Crd.Spec.AdditionalPrinterColumn col : Arrays.stream(crd.additionalPrinterColumns()).filter(col -> crApiVersion == null || ApiVersion.parseRange(col.apiVersion()).contains(crApiVersion)).collect(Collectors.toList())) {
ObjectNode colNode = cols.addObject();
colNode.put("name", col.name());
colNode.put("description", col.description());
colNode.put(crdApiVersion.compareTo(V1) >= 0 ? "jsonPath" : "JSONPath", col.jsonPath());
colNode.put("type", col.type());
if (col.priority() != 0) {
colNode.put("priority", col.priority());
}
if (!col.format().isEmpty()) {
colNode.put("format", col.format());
}
}
}
return cols;
}
use of io.strimzi.crdgenerator.annotations.Type in project strimzi by strimzi.
the class CrdGenerator method buildBasicTypeSchema.
private ObjectNode buildBasicTypeSchema(AnnotatedElement element, Class type) {
ObjectNode result = nf.objectNode();
String typeName;
Type typeAnno = element.getAnnotation(Type.class);
if (typeAnno == null) {
typeName = typeName(type);
if (Map.class.equals(type)) {
preserveUnknownFields(result);
}
} else {
typeName = typeAnno.value();
}
result.put("type", typeName);
return result;
}
use of io.strimzi.crdgenerator.annotations.Type in project strimzi-kafka-operator by strimzi.
the class CrdGenerator method buildAdditionalPrinterColumns.
private ArrayNode buildAdditionalPrinterColumns(Crd.Spec crd, ApiVersion crApiVersion) {
ArrayNode cols = nf.arrayNode();
if (crd.additionalPrinterColumns().length != 0) {
for (Crd.Spec.AdditionalPrinterColumn col : Arrays.stream(crd.additionalPrinterColumns()).filter(col -> crApiVersion == null || ApiVersion.parseRange(col.apiVersion()).contains(crApiVersion)).collect(Collectors.toList())) {
ObjectNode colNode = cols.addObject();
colNode.put("name", col.name());
colNode.put("description", col.description());
colNode.put(crdApiVersion.compareTo(V1) >= 0 ? "jsonPath" : "JSONPath", col.jsonPath());
colNode.put("type", col.type());
if (col.priority() != 0) {
colNode.put("priority", col.priority());
}
if (!col.format().isEmpty()) {
colNode.put("format", col.format());
}
}
}
return cols;
}
use of io.strimzi.crdgenerator.annotations.Type in project strimzi-kafka-operator by strimzi.
the class CrdGenerator method buildBasicTypeSchema.
private ObjectNode buildBasicTypeSchema(AnnotatedElement element, Class type) {
ObjectNode result = nf.objectNode();
String typeName;
Type typeAnno = element.getAnnotation(Type.class);
if (typeAnno == null) {
typeName = typeName(type);
if (Map.class.equals(type)) {
preserveUnknownFields(result);
}
} else {
typeName = typeAnno.value();
}
result.put("type", typeName);
return result;
}
Aggregations