[
https://issues.apache.org/jira/browse/AVRO-1274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tom White updated AVRO-1274:
----------------------------
Attachment: AVRO-1274.patch
Here's a new patch which hopefully will address all of Scott's points.
* Add required/optional{Record,Enum,Array,Map,Fixed) methods that enforce type
safety for defaults. (Previously the method was just called optionalType and
took an Object).
* Add unionX methods for all types X to enforce type safety for defaults. To
build a field that is a union of a long (default 1) and an int you would say
{{unionLong("unionLongWithDefault", 1L, SchemaBuilder.INT)}}
* To build union fields without defaults, you would use the unionType method.
This covers the "nullable with no default" case above.
* To cover the remaining "non-nullable with a default" case, I've added an
"expert" defaultValue() method to the builder, so you can say
{{requiredBoolean("requiredBooleanWithDefault").defaultValue(true)}} and in
this way it's possible to define a field like this, while not making it
something most users will stumble across inadvertantly.
> Add a schema builder API
> ------------------------
>
> Key: AVRO-1274
> URL: https://issues.apache.org/jira/browse/AVRO-1274
> Project: Avro
> Issue Type: New Feature
> Components: java
> Reporter: Tom White
> Assignee: Tom White
> Attachments: AVRO-1274.patch, AVRO-1274.patch, AVRO-1274.patch,
> AVRO-1274.patch, AVRO-1274.patch, AVRO-1274.patch, TestDefaults.patch
>
>
> It would be nice to have a fluent API that made it easier to construct record
> schemas.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira