This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "record", | |
"namespace": "co.uk.dalelane", | |
"name": "Type14", | |
"fields": [ | |
{ | |
"name": "something", | |
"type": "string" | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Type13 myThing = new Type13(); | |
myThing.setMyWord("diabolical"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LogicalTypes.register(WordsThatStartWithD.PROPERTY_NAME, | |
new WordsThatStartWithD.TypeFactory()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.avro.LogicalType; | |
import org.apache.avro.LogicalTypes.LogicalTypeFactory; | |
import org.apache.avro.Schema; | |
public class WordsThatStartWithD extends LogicalType { | |
public static final String PROPERTY_NAME = "words-that-start-with-D"; | |
private static final String INVALID_TYPE = "Logical type 'words-that-start-with-D' must be strings"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "record", | |
"namespace": "co.uk.dalelane", | |
"name": "Type13", | |
"fields": [ | |
{ | |
"name": "myWord", | |
"type": { | |
"type": "string", | |
"name": "WordThatStartsWithD", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Type12 myThing = new Type12(); | |
myThing.setPreciselyWhenItHappened(System.currentTimeMillis()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "record", | |
"name": "Type12", | |
"namespace": "co.uk.dalelane", | |
"fields": [ | |
{ | |
"name": "preciselyWhenItHappened", | |
"type": "long", | |
"logicalType": "time-millis" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Type10 myThing = new Type10(); | |
myThing.setWhenItHappened(LocalDate.now().toEpochDay()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "record", | |
"name": "Type10", | |
"namespace": "co.uk.dalelane", | |
"fields": [ | |
{ | |
"name": "whenItHappened", | |
"type": "long", | |
"logicalType": "date" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Type9 myThingA = new Type9(); | |
myThingA.setRequiredString("Hello"); | |
myThingA.setOptionalString("World"); | |
Type9 myThingB = new Type9(); | |
myThingB.setRequiredString("Hello"); |