@Test void nullField() { final AvroSchema schema = new AvroSchema(Schema .createRecord(singletonList(new Schema.Field("nf", Schema.create(Schema.Type.NULL), null, null)))); assertTrue(schema.getEntries().isEmpty()); assertEquals("AvroSchema(delegate={\"type\":\"record\",\"fields\":[{\"name\":\"nf\",\"type\":\"null\"}]})", schema.toString()); }
@Override public List<Entry> getEntries() { if (getActualDelegate().getType() != Schema.Type.RECORD) { return emptyList(); } if (entries != null) { return entries; } synchronized (this) { if (entries != null) { return entries; } entries = getActualDelegate().getFields().stream().filter(it -> it.schema().getType() != NULL).map(field -> { final Type type = mapType(field.schema()); final AvroSchema elementSchema = new AvroSchema( type == Type.ARRAY ? unwrapUnion(field.schema()).getElementType() : field.schema()); return new SchemaImpl.EntryImpl(field.name(), field.getProp(KeysForAvroProperty.LABEL), type, field.schema().getType() == UNION, field.defaultVal(), elementSchema, field.doc()); }).collect(toList()); } return entries; }
AvroSchema implements org.talend.sdk.component.api.record.Schema, AvroPropertyMapper, Unwrappable { @Override public List<Entry> getEntries() { if (getActualDelegate().getType() != Schema.Type.RECORD) { return emptyList(); } if (entries != null) { return entries; } synchronized (this) { if (entries != null) { return entries; } entries = getActualDelegate().getFields().stream().filter(it -> it.schema().getType() != NULL).map(field -> { final Type type = mapType(field.schema()); final AvroSchema elementSchema = new AvroSchema( type == Type.ARRAY ? unwrapUnion(field.schema()).getElementType() : field.schema()); return new SchemaImpl.EntryImpl(field.name(), field.getProp(KeysForAvroProperty.LABEL), type, field.schema().getType() == UNION, field.defaultVal(), elementSchema, field.doc()); }).collect(toList()); } return entries; } }
AvroSchema implements org.talend.sdk.component.api.record.Schema, AvroPropertyMapper, Unwrappable { @Override public List<Entry> getEntries() { if (getActualDelegate().getType() != Schema.Type.RECORD) { return emptyList(); } if (entries != null) { return entries; } synchronized (this) { if (entries != null) { return entries; } entries = getActualDelegate().getFields().stream().filter(it -> it.schema().getType() != NULL).map(field -> { final Type type = mapType(field.schema()); final AvroSchema elementSchema = new AvroSchema( type == Type.ARRAY ? unwrapUnion(field.schema()).getElementType() : field.schema()); return new SchemaImpl.EntryImpl(field.name(), field.getProp(KeysForAvroProperty.LABEL), type, field.schema().getType() == UNION, field.defaultVal(), elementSchema, field.doc()); }).collect(toList()); } return entries; }  }
AvroSchema implements org.talend.sdk.component.api.record.Schema, AvroPropertyMapper, Unwrappable { @Override public List<Entry> getEntries() { if (getActualDelegate().getType() != Schema.Type.RECORD) { return emptyList(); } if (entries != null) { return entries; } synchronized (this) { if (entries != null) { return entries; } entries = getActualDelegate().getFields().stream().filter(it -> it.schema().getType() != NULL).map(field -> { final Type type = mapType(field.schema()); final AvroSchema elementSchema = new AvroSchema( type == Type.ARRAY ? unwrapUnion(field.schema()).getElementType() : field.schema()); return new SchemaImpl.EntryImpl(field.name(), field.getProp(KeysForAvroProperty.LABEL), type, field.schema().getType() == UNION, field.defaultVal(), elementSchema, field.doc()); }).collect(toList()); } return entries; }  @Override Type getType(); @Override org.talend.sdk.component.api.record.Schema getElementSchema(); @Override List<Entry> getEntries(); @Override T unwrap(final Class<T> type); }
AvroSchema implements org.talend.sdk.component.api.record.Schema, AvroPropertyMapper, Unwrappable { @Override public List<Entry> getEntries() { if (getActualDelegate().getType() != Schema.Type.RECORD) { return emptyList(); } if (entries != null) { return entries; } synchronized (this) { if (entries != null) { return entries; } entries = getActualDelegate().getFields().stream().filter(it -> it.schema().getType() != NULL).map(field -> { final Type type = mapType(field.schema()); final AvroSchema elementSchema = new AvroSchema( type == Type.ARRAY ? unwrapUnion(field.schema()).getElementType() : field.schema()); return new SchemaImpl.EntryImpl(field.name(), field.getProp(KeysForAvroProperty.LABEL), type, field.schema().getType() == UNION, field.defaultVal(), elementSchema, field.doc()); }).collect(toList()); } return entries; }  @Override Type getType(); @Override org.talend.sdk.component.api.record.Schema getElementSchema(); @Override List<Entry> getEntries(); @Override T unwrap(final Class<T> type);  }