public static FieldsMappingOption copyByReference() { return FieldsMappingOptions.copyByReference(); }
public static FieldsMappingOption copyByReference() { return FieldsMappingOptions.copyByReference(); }
@Override protected void configure() { mapping(FieldDto.class, FieldInfo.class) .fields("type", "type", FieldsMappingOptions.customConverterId("typeConverter")) .fields("partition_key", "partitionKey", FieldsMappingOptions.copyByReference()) .fields("source_type", "sourceType", FieldsMappingOptions.copyByReference()); mapping(TableDto.class, TableInfo.class) .fields("name", "name", FieldsMappingOptions.copyByReference()); mapping(DatabaseDto.class, DatabaseInfo.class) .fields("name", "name", FieldsMappingOptions.copyByReference()); mapping(PartitionDto.class, PartitionInfo.class) .fields("name", "name", FieldsMappingOptions.copyByReference()); mapping(AuditDto.class, AuditInfo.class); mapping(ViewDto.class, ViewInfo.class); mapping(StorageDto.class, StorageInfo.class); } };
@Override protected void configure() { mapping(FieldDto.class, FieldInfo.class) .fields("type", "type", FieldsMappingOptions.customConverterId("typeConverter")) .fields("partition_key", "partitionKey", FieldsMappingOptions.copyByReference()) .fields("source_type", "sourceType", FieldsMappingOptions.copyByReference()); mapping(TableDto.class, TableInfo.class) .fields("name", "name", FieldsMappingOptions.copyByReference()); mapping(DatabaseDto.class, DatabaseInfo.class) .fields("name", "name", FieldsMappingOptions.copyByReference()); mapping(PartitionDto.class, PartitionInfo.class) .fields("name", "name", FieldsMappingOptions.copyByReference()); mapping(AuditDto.class, AuditInfo.class); mapping(ViewDto.class, ViewInfo.class); mapping(StorageDto.class, StorageInfo.class); } };
@Override protected void configure() { /* * Add the required dozer mappings to map from each field in the supplied class to its associated column (in * the CsvDozerBeanData List). mapNull is enabled so that null field values are added to the List (otherwise * the List would be too short!). oneWay is enabled just in case a custom DozerBeanMapper is supplied (so * the same DozerBeanMapper can be used by CsvDozerBeanReader). wildcard is disabled to prevent Dozer from * trying to map every field in the bean automatically. copyByReference is enabled on the field mapping to * ensure no conversions are performed (bean values are just copied to the List). */ final TypeMappingBuilder mappingBuilder = mapping(clazz, type(CsvDozerBeanData.class).mapNull(true), oneWay(), wildcard(false)); for( int i = 0; i < fieldMapping.length; i++ ) { final String mapping = fieldMapping[i]; if( mapping == null ) { // a null field mapping at end of array results in the List being too short, so don't allow throw new NullPointerException(String.format("fieldMapping at index %d should not be null", i)); } // add a field mapping from the field to the appropriate column in the beanData List mappingBuilder.fields(mapping, "columns[" + i + "]", FieldsMappingOptions.copyByReference()); } } }