Skip to content

Commit 949378a

Browse files
authored
CAMEL-12941: camel-bindy - Add option to use null as default value for string types (#20607)
1 parent 6dcdb4a commit 949378a

File tree

29 files changed

+252
-33
lines changed

29 files changed

+252
-33
lines changed

catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/bindyCsv.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" },
2020
"type": { "index": 1, "kind": "attribute", "displayName": "Type", "group": "common", "required": true, "type": "enum", "javaType": "org.apache.camel.model.dataformat.BindyType", "enum": [ "Csv", "Fixed", "KeyValue" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Csv", "description": "Whether to use Csv, Fixed, or KeyValue." },
2121
"classType": { "index": 2, "kind": "attribute", "displayName": "Class Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of model class to use." },
22-
"allowEmptyStream": { "index": 3, "kind": "attribute", "displayName": "Allow Empty Stream", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow empty streams in the unmarshal process. If true, no exception will be thrown when a body without records is provided." },
23-
"unwrapSingleInstance": { "index": 4, "kind": "attribute", "displayName": "Unwrap Single Instance", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "When unmarshalling should a single instance be unwrapped and returned instead of wrapped in a java.util.List." },
24-
"locale": { "index": 5, "kind": "attribute", "displayName": "Locale", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To configure a default locale to use, such as us for united states. To use the JVM platform default locale then use the name default" }
22+
"defaultValueStringAsNull": { "index": 3, "kind": "attribute", "displayName": "Default Value String As Null", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To change the default value for string types to be null instead of an empty string." },
23+
"allowEmptyStream": { "index": 4, "kind": "attribute", "displayName": "Allow Empty Stream", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow empty streams in the unmarshal process. If true, no exception will be thrown when a body without records is provided." },
24+
"unwrapSingleInstance": { "index": 5, "kind": "attribute", "displayName": "Unwrap Single Instance", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "When unmarshalling should a single instance be unwrapped and returned instead of wrapped in a java.util.List." },
25+
"locale": { "index": 6, "kind": "attribute", "displayName": "Locale", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To configure a default locale to use, such as us for united states. To use the JVM platform default locale then use the name default" }
2526
}
2627
}

catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/bindyFixed.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" },
2020
"type": { "index": 1, "kind": "attribute", "displayName": "Type", "group": "common", "required": true, "type": "enum", "javaType": "org.apache.camel.model.dataformat.BindyType", "enum": [ "Csv", "Fixed", "KeyValue" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Fixed", "description": "Whether to use Csv, Fixed, or KeyValue." },
2121
"classType": { "index": 2, "kind": "attribute", "displayName": "Class Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of model class to use." },
22-
"allowEmptyStream": { "index": 3, "kind": "attribute", "displayName": "Allow Empty Stream", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow empty streams in the unmarshal process. If true, no exception will be thrown when a body without records is provided." },
23-
"unwrapSingleInstance": { "index": 4, "kind": "attribute", "displayName": "Unwrap Single Instance", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "When unmarshalling should a single instance be unwrapped and returned instead of wrapped in a java.util.List." },
24-
"locale": { "index": 5, "kind": "attribute", "displayName": "Locale", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To configure a default locale to use, such as us for united states. To use the JVM platform default locale then use the name default" }
22+
"defaultValueStringAsNull": { "index": 3, "kind": "attribute", "displayName": "Default Value String As Null", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To change the default value for string types to be null instead of an empty string." },
23+
"allowEmptyStream": { "index": 4, "kind": "attribute", "displayName": "Allow Empty Stream", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow empty streams in the unmarshal process. If true, no exception will be thrown when a body without records is provided." },
24+
"unwrapSingleInstance": { "index": 5, "kind": "attribute", "displayName": "Unwrap Single Instance", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "When unmarshalling should a single instance be unwrapped and returned instead of wrapped in a java.util.List." },
25+
"locale": { "index": 6, "kind": "attribute", "displayName": "Locale", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To configure a default locale to use, such as us for united states. To use the JVM platform default locale then use the name default" }
2526
}
2627
}

catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/bindyKvp.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" },
2020
"type": { "index": 1, "kind": "attribute", "displayName": "Type", "group": "common", "required": true, "type": "enum", "javaType": "org.apache.camel.model.dataformat.BindyType", "enum": [ "Csv", "Fixed", "KeyValue" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "KeyValue", "description": "Whether to use Csv, Fixed, or KeyValue." },
2121
"classType": { "index": 2, "kind": "attribute", "displayName": "Class Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of model class to use." },
22-
"allowEmptyStream": { "index": 3, "kind": "attribute", "displayName": "Allow Empty Stream", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow empty streams in the unmarshal process. If true, no exception will be thrown when a body without records is provided." },
23-
"unwrapSingleInstance": { "index": 4, "kind": "attribute", "displayName": "Unwrap Single Instance", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "When unmarshalling should a single instance be unwrapped and returned instead of wrapped in a java.util.List." },
24-
"locale": { "index": 5, "kind": "attribute", "displayName": "Locale", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To configure a default locale to use, such as us for united states. To use the JVM platform default locale then use the name default" }
22+
"defaultValueStringAsNull": { "index": 3, "kind": "attribute", "displayName": "Default Value String As Null", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To change the default value for string types to be null instead of an empty string." },
23+
"allowEmptyStream": { "index": 4, "kind": "attribute", "displayName": "Allow Empty Stream", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow empty streams in the unmarshal process. If true, no exception will be thrown when a body without records is provided." },
24+
"unwrapSingleInstance": { "index": 5, "kind": "attribute", "displayName": "Unwrap Single Instance", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "When unmarshalling should a single instance be unwrapped and returned instead of wrapped in a java.util.List." },
25+
"locale": { "index": 6, "kind": "attribute", "displayName": "Locale", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To configure a default locale to use, such as us for united states. To use the JVM platform default locale then use the name default" }
2526
}
2627
}

catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/bindy.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" },
1717
"type": { "index": 1, "kind": "attribute", "displayName": "Type", "group": "common", "required": true, "type": "enum", "javaType": "org.apache.camel.model.dataformat.BindyType", "enum": [ "Csv", "Fixed", "KeyValue" ], "deprecated": false, "autowired": false, "secret": false, "description": "Whether to use Csv, Fixed, or KeyValue." },
1818
"classType": { "index": 2, "kind": "attribute", "displayName": "Class Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of model class to use." },
19-
"allowEmptyStream": { "index": 3, "kind": "attribute", "displayName": "Allow Empty Stream", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow empty streams in the unmarshal process. If true, no exception will be thrown when a body without records is provided." },
20-
"unwrapSingleInstance": { "index": 4, "kind": "attribute", "displayName": "Unwrap Single Instance", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "When unmarshalling should a single instance be unwrapped and returned instead of wrapped in a java.util.List." },
21-
"locale": { "index": 5, "kind": "attribute", "displayName": "Locale", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To configure a default locale to use, such as us for united states. To use the JVM platform default locale then use the name default" }
19+
"defaultValueStringAsNull": { "index": 3, "kind": "attribute", "displayName": "Default Value String As Null", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To change the default value for string types to be null instead of an empty string." },
20+
"allowEmptyStream": { "index": 4, "kind": "attribute", "displayName": "Allow Empty Stream", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow empty streams in the unmarshal process. If true, no exception will be thrown when a body without records is provided." },
21+
"unwrapSingleInstance": { "index": 5, "kind": "attribute", "displayName": "Unwrap Single Instance", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "When unmarshalling should a single instance be unwrapped and returned instead of wrapped in a java.util.List." },
22+
"locale": { "index": 6, "kind": "attribute", "displayName": "Locale", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To configure a default locale to use, such as us for united states. To use the JVM platform default locale then use the name default" }
2223
}
2324
}

catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8070,6 +8070,15 @@ Whether to use Csv, Fixed, or KeyValue.
80708070
<xs:documentation xml:lang="en">
80718071
<![CDATA[
80728072
Name of model class to use.
8073+
]]>
8074+
</xs:documentation>
8075+
</xs:annotation>
8076+
</xs:attribute>
8077+
<xs:attribute name="defaultValueStringAsNull" type="xs:string">
8078+
<xs:annotation>
8079+
<xs:documentation xml:lang="en">
8080+
<![CDATA[
8081+
To change the default value for string types to be null instead of an empty string. Default value: false
80738082
]]>
80748083
</xs:documentation>
80758084
</xs:annotation>

catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6743,6 +6743,15 @@ Whether to use Csv, Fixed, or KeyValue.
67436743
<xs:documentation xml:lang="en">
67446744
<![CDATA[
67456745
Name of model class to use.
6746+
]]>
6747+
</xs:documentation>
6748+
</xs:annotation>
6749+
</xs:attribute>
6750+
<xs:attribute name="defaultValueStringAsNull" type="xs:string">
6751+
<xs:annotation>
6752+
<xs:documentation xml:lang="en">
6753+
<![CDATA[
6754+
To change the default value for string types to be null instead of an empty string. Default value: false
67466755
]]>
67476756
</xs:documentation>
67486757
</xs:annotation>

components/camel-bindy/src/generated/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormatConfigurer.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class BindyCsvDataFormatConfigurer extends org.apache.camel.support.compo
2424
Map<String, Object> map = new CaseInsensitiveMap();
2525
map.put("AllowEmptyStream", boolean.class);
2626
map.put("ClassType", java.lang.Class.class);
27+
map.put("DefaultValueStringAsNull", boolean.class);
2728
map.put("Locale", java.lang.String.class);
2829
map.put("UnwrapSingleInstance", boolean.class);
2930
ALL_OPTIONS = map;
@@ -37,6 +38,8 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj
3738
case "allowEmptyStream": target.setAllowEmptyStream(property(camelContext, boolean.class, value)); return true;
3839
case "classtype":
3940
case "classType": target.setClassType(property(camelContext, java.lang.Class.class, value)); return true;
41+
case "defaultvaluestringasnull":
42+
case "defaultValueStringAsNull": target.setDefaultValueStringAsNull(property(camelContext, boolean.class, value)); return true;
4043
case "locale": target.setLocale(property(camelContext, java.lang.String.class, value)); return true;
4144
case "unwrapsingleinstance":
4245
case "unwrapSingleInstance": target.setUnwrapSingleInstance(property(camelContext, boolean.class, value)); return true;
@@ -56,6 +59,8 @@ public Class<?> getOptionType(String name, boolean ignoreCase) {
5659
case "allowEmptyStream": return boolean.class;
5760
case "classtype":
5861
case "classType": return java.lang.Class.class;
62+
case "defaultvaluestringasnull":
63+
case "defaultValueStringAsNull": return boolean.class;
5964
case "locale": return java.lang.String.class;
6065
case "unwrapsingleinstance":
6166
case "unwrapSingleInstance": return boolean.class;
@@ -71,6 +76,8 @@ public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
7176
case "allowEmptyStream": return target.isAllowEmptyStream();
7277
case "classtype":
7378
case "classType": return target.getClassType();
79+
case "defaultvaluestringasnull":
80+
case "defaultValueStringAsNull": return target.isDefaultValueStringAsNull();
7481
case "locale": return target.getLocale();
7582
case "unwrapsingleinstance":
7683
case "unwrapSingleInstance": return target.isUnwrapSingleInstance();

0 commit comments

Comments
 (0)