Create a schema for a primitive type.
(Type type)
| 150 | |
| 151 | /** Create a schema for a primitive type. */ |
| 152 | public static Schema create(Type type) { |
| 153 | switch (type) { |
| 154 | case STRING: |
| 155 | return new StringSchema(); |
| 156 | case BYTES: |
| 157 | return new BytesSchema(); |
| 158 | case INT: |
| 159 | return new IntSchema(); |
| 160 | case LONG: |
| 161 | return new LongSchema(); |
| 162 | case FLOAT: |
| 163 | return new FloatSchema(); |
| 164 | case DOUBLE: |
| 165 | return new DoubleSchema(); |
| 166 | case BOOLEAN: |
| 167 | return new BooleanSchema(); |
| 168 | case NULL: |
| 169 | return new NullSchema(); |
| 170 | default: |
| 171 | throw new AvroRuntimeException("Can't create a: " + type); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | private static final Set<String> SCHEMA_RESERVED = new HashSet<>( |
| 176 | Arrays.asList("doc", "fields", "items", "name", "namespace", "size", "symbols", "values", "type", "aliases")); |
no outgoing calls