@Test public void testPreventsTwoFieldsWithConflictingNamesAliases() { final List<RecordField> fields = new ArrayList<>(); fields.add(new RecordField("hello", RecordFieldType.STRING.getDataType(), null, set("foo", "bar"))); fields.add(new RecordField("bar", RecordFieldType.STRING.getDataType())); try { new SimpleRecordSchema(fields); Assert.fail("Was able to create two fields with conflicting names/aliases"); } catch (final IllegalArgumentException expected) { } }
@Override public Optional<DataType> getDataType(final String fieldName) { final RecordField field = fieldMap.get(fieldName); if (field == null) { return Optional.empty(); } return Optional.of(field.getDataType()); }
SimpleRecordSchema implements RecordSchema { @Override public Optional<DataType> getDataType(final String fieldName) { final RecordField field = fieldMap.get(fieldName); if (field == null) { return Optional.empty(); } return Optional.of(field.getDataType()); } }
SimpleRecordSchema implements RecordSchema { @Override public Optional<DataType> getDataType(final String fieldName) { final RecordField field = fieldMap.get(fieldName); if (field == null) { return Optional.empty(); } return Optional.of(field.getDataType()); } SimpleRecordSchema(final List<RecordField> fields);  SimpleRecordSchema(final List<RecordField> fields, final SchemaIdentifier id);  SimpleRecordSchema(final String text, final String schemaFormat, final SchemaIdentifier id);  SimpleRecordSchema(final List<RecordField> fields, final String text, final String schemaFormat, final SchemaIdentifier id); private  SimpleRecordSchema(final List<RecordField> fields, final String text, final String schemaFormat, final boolean textAvailable, final SchemaIdentifier id); private  SimpleRecordSchema(final String text, final String schemaFormat, final boolean textAvailable, final SchemaIdentifier id); }
SimpleRecordSchema implements RecordSchema { @Override public Optional<DataType> getDataType(final String fieldName) { final RecordField field = fieldMap.get(fieldName); if (field == null) { return Optional.empty(); } return Optional.of(field.getDataType()); } SimpleRecordSchema(final List<RecordField> fields);  SimpleRecordSchema(final List<RecordField> fields, final SchemaIdentifier id);  SimpleRecordSchema(final String text, final String schemaFormat, final SchemaIdentifier id);  SimpleRecordSchema(final List<RecordField> fields, final String text, final String schemaFormat, final SchemaIdentifier id); private  SimpleRecordSchema(final List<RecordField> fields, final String text, final String schemaFormat, final boolean textAvailable, final SchemaIdentifier id); private  SimpleRecordSchema(final String text, final String schemaFormat, final boolean textAvailable, final SchemaIdentifier id); @Override Optional<String> getSchemaText(); @Override Optional<String> getSchemaFormat(); @Override List<RecordField> getFields(); void setFields(final List<RecordField> fields); @Override int getFieldCount(); @Override RecordField getField(final int index); @Override List<DataType> getDataTypes(); @Override List<String> getFieldNames(); @Override Optional<DataType> getDataType(final String fieldName); @Override Optional<RecordField> getField(final String fieldName); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString(); @Override SchemaIdentifier getIdentifier(); }
SimpleRecordSchema implements RecordSchema { @Override public Optional<DataType> getDataType(final String fieldName) { final RecordField field = fieldMap.get(fieldName); if (field == null) { return Optional.empty(); } return Optional.of(field.getDataType()); } SimpleRecordSchema(final List<RecordField> fields);  SimpleRecordSchema(final List<RecordField> fields, final SchemaIdentifier id);  SimpleRecordSchema(final String text, final String schemaFormat, final SchemaIdentifier id);  SimpleRecordSchema(final List<RecordField> fields, final String text, final String schemaFormat, final SchemaIdentifier id); private  SimpleRecordSchema(final List<RecordField> fields, final String text, final String schemaFormat, final boolean textAvailable, final SchemaIdentifier id); private  SimpleRecordSchema(final String text, final String schemaFormat, final boolean textAvailable, final SchemaIdentifier id); @Override Optional<String> getSchemaText(); @Override Optional<String> getSchemaFormat(); @Override List<RecordField> getFields(); void setFields(final List<RecordField> fields); @Override int getFieldCount(); @Override RecordField getField(final int index); @Override List<DataType> getDataTypes(); @Override List<String> getFieldNames(); @Override Optional<DataType> getDataType(final String fieldName); @Override Optional<RecordField> getField(final String fieldName); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString(); @Override SchemaIdentifier getIdentifier();  }