T read(Decoder in) throws IOException { return this.read(null, in); }
@Override protected void write(Object object, Encoder out) throws IOException { encoding.write(UNSAFE.getObject(object, offset), out); }
/** Create a schema for a field. */ protected Schema createFieldSchema(Field field, Map<String, Schema> names) { AvroEncode enc = field.getAnnotation(AvroEncode.class); if (enc != null) try { return enc.using().newInstance().getSchema(); } catch (Exception e) { throw new AvroRuntimeException("Could not create schema from custom serializer for " + field.getName()); } AvroSchema explicit = field.getAnnotation(AvroSchema.class); if (explicit != null) // explicit schema return Schema.parse(explicit.value()); Schema schema = createSchema(field.getGenericType(), names); if (field.isAnnotationPresent(Stringable.class)) { // Stringable schema = Schema.create(Schema.Type.STRING); } if (field.isAnnotationPresent(Nullable.class)) // nullable schema = makeNullable(schema); return schema; }
/** Create a schema for a field. */ protected Schema createFieldSchema(Field field, Map<String, Schema> names) { AvroEncode enc = field.getAnnotation(AvroEncode.class); if (enc != null) try { return enc.using().newInstance().getSchema(); } catch (Exception e) { throw new AvroRuntimeException("Could not create schema from custom serializer for " + field.getName()); } AvroSchema explicit = field.getAnnotation(AvroSchema.class); if (explicit != null) // explicit schema return Schema.parse(explicit.value()); Union union = field.getAnnotation(Union.class); if (union != null) return getAnnotatedUnion(union, names); Schema schema = createSchema(field.getGenericType(), names); if (field.isAnnotationPresent(Stringable.class)) { // Stringable schema = Schema.create(Schema.Type.STRING); } if (field.isAnnotationPresent(Nullable.class)) // nullable schema = makeNullable(schema); return schema; }
T read(Decoder in) throws IOException { return this.read(null, in); }
@Override protected void write(Object object, Encoder out) throws IOException { encoding.write(UNSAFE.getObject(object, offset), out); }
/** Create a schema for a field. */ protected Schema createFieldSchema(Field field, Map<String, Schema> names) { AvroEncode enc = field.getAnnotation(AvroEncode.class); if (enc != null) try { return enc.using().newInstance().getSchema(); } catch (Exception e) { throw new AvroRuntimeException("Could not create schema from custom serializer for " + field.getName()); } Schema schema = createSchema(field.getGenericType(), names); if (field.isAnnotationPresent(Stringable.class)) { // Stringable schema = Schema.create(Schema.Type.STRING); } if (field.isAnnotationPresent(Nullable.class)) // nullable schema = makeNullable(schema); return schema; }
@Override protected void read(Object object, Decoder in) throws IOException { UNSAFE.putObject(object, offset, encoding.read(in)); }
@Override protected void write(Object object, Encoder out) throws IOException { try { encoding.write(field.get(object), out); } catch (IllegalAccessException e) { throw new AvroRuntimeException(e); } }
/** Create a schema for a field. */ protected Schema createFieldSchema(Field field, Map<String, Schema> names) { AvroEncode enc = field.getAnnotation(AvroEncode.class); if (enc != null) try { return enc.using().newInstance().getSchema(); } catch (Exception e) { throw new AvroRuntimeException("Could not create schema from custom serializer for " + field.getName()); } AvroSchema explicit = field.getAnnotation(AvroSchema.class); if (explicit != null) // explicit schema return Schema.parse(explicit.value()); Schema schema = createSchema(field.getGenericType(), names); if (field.isAnnotationPresent(Stringable.class)) { // Stringable schema = Schema.create(Schema.Type.STRING); } if (field.isAnnotationPresent(Nullable.class)) // nullable schema = makeNullable(schema); return schema; }
@Override protected void read(Object object, Decoder in) throws IOException { try { field.set(object, encoding.read(in)); } catch (IllegalAccessException e) { throw new AvroRuntimeException(e); } }
@Override protected void write(Object object, Encoder out) throws IOException { try { encoding.write(field.get(object), out); } catch (IllegalAccessException e) { throw new AvroRuntimeException(e); } }
@Override protected void read(Object object, Decoder in) throws IOException { UNSAFE.putObject(object, offset, encoding.read(in)); }
@Override protected void write(Object object, Encoder out) throws IOException { encoding.write(UNSAFE.getObject(object, offset), out); }
@Override protected void read(Object object, Decoder in) throws IOException { try { field.set(object, encoding.read(in)); } catch (IllegalAccessException e) { throw new AvroRuntimeException(e); } }
@Override protected void write(Object object, Encoder out) throws IOException { encoding.write(UNSAFE.getObject(object, offset), out); }
T read(Decoder in) throws IOException { return this.read(null, in); }
@Override protected void write(Object object, Encoder out) throws IOException { try { encoding.write(field.get(object), out); } catch (IllegalAccessException e) { throw new AvroRuntimeException(e); } }
T read(Decoder in) throws IOException { return this.read(null, in); }
@Override protected void read(Object object, Decoder in) throws IOException { try { field.set(object, encoding.read(in)); } catch (IllegalAccessException e) { throw new AvroRuntimeException(e); } }