@SuppressWarnings("unchecked") private <P> ContextualGetter<S, P> newMapperGetterAdapter(SourceMapper<S, ?> mapper, MappingContextFactoryBuilder<S, K> builder) { return new MapperFieldMapperGetterAdapter<S, P>((SourceMapper<S, P>)mapper, builder.nullChecker(), builder.currentIndex()); }
@SuppressWarnings("unchecked") private <P> ContextualGetter<S, P> newMapperGetterAdapter(SourceMapper<S, ?> mapper, MappingContextFactoryBuilder<S, K> builder) { return new MapperFieldMapperGetterAdapter<S, P>((SourceMapper<S, P>)mapper, builder.nullChecker(), builder.currentIndex()); }
private <P> FieldMapper<S, T> newMapperFieldMapper(List<PropertyMapping<T, ?, K>> properties, Setter<T, P> setter, SourceMapper<S, ?> mapper, MappingContextFactoryBuilder<S, K> mappingContextFactoryBuilder) { final MapperFieldMapper fieldMapper = new MapperFieldMapper(mapper, (Setter<T, P>)setter, mappingContextFactoryBuilder.nullChecker(), mappingContextFactoryBuilder.currentIndex()); return wrapFieldMapperWithErrorHandler(properties.get(0).getColumnKey(), fieldMapper); }
private <P> FieldMapper<S, T> newMapperFieldMapper(List<PropertyMapping<T, ?, K>> properties, Setter<T, P> setter, SourceMapper<S, ?> mapper, MappingContextFactoryBuilder<S, K> mappingContextFactoryBuilder) { final MapperFieldMapper fieldMapper = new MapperFieldMapper(mapper, (Setter<T, P>)setter, mappingContextFactoryBuilder.nullChecker(), mappingContextFactoryBuilder.currentIndex()); return wrapFieldMapperWithErrorHandler(properties.get(0).getColumnKey(), fieldMapper); }
@Test public void testKeys() throws Exception { builder.addKey(new KeyAndPredicate<Object[], SampleFieldKey>(new SampleFieldKey("k1", 0), null)); assertFalse(builder.hasNoKeys()); MappingContextFactory<Object[]> mappingContextFactory = builder.build(); assertTrue(mappingContextFactory instanceof BreakDetectorMappingContextFactory); assertNull(mappingContextFactory.newContext().context(0)); assertTrue(builder.nullChecker().test(new Object[] { null})); assertFalse(builder.nullChecker().test(new Object[] { 123 })); }