public GetterFactory<?, K> getCustomGetterFactoryFrom(Type sourceType) { for(GetterFactoryProperty getterFactoryProperty : lookForAll(GetterFactoryProperty.class)) { if (getterFactoryProperty.getSourceType() == null || TypeHelper.isAssignable(getterFactoryProperty.getSourceType(), sourceType)) { return (GetterFactory<?, K>) getterFactoryProperty.getGetterFactory(); } } return null; }
@Test public void testGetterFactoryProperty() { GetterFactory<Object, Object> getterFactory = new GetterFactory<Object, Object>() { @Override public <P> Getter<Object, P> newGetter(Type target, Object key, Object... properties) { return null; } @Override public String toString() { return "GF"; } }; GetterFactoryProperty getterFactoryProperty = new GetterFactoryProperty(getterFactory); assertSame(getterFactory, getterFactoryProperty.getGetterFactory()); assertEquals("GetterFactory{GF}", getterFactoryProperty.toString()); }
public FieldMapperColumnDefinition<K> addGetterFactory(GetterFactory<?, K> getterFactory) { return add(new GetterFactoryProperty(getterFactory)); } public FieldMapperColumnDefinition<K> addFieldMapper(FieldMapper<?, ?> mapper){
public GetterFactoryProperty(GetterFactory<?, ?> getterFactory) { this(getterFactory, getSourceType(getterFactory)); }
public FieldMapperColumnDefinition<K> addGetterFactory(GetterFactory<?, K> getterFactory) { return add(new GetterFactoryProperty(getterFactory)); } public FieldMapperColumnDefinition<K> addFieldMapper(FieldMapper<?, ?> mapper){
public GetterFactoryProperty(GetterFactory<?, ?> getterFactory) { this(getterFactory, getSourceType(getterFactory)); }
public GetterFactory<?, K> getCustomGetterFactoryFrom(Type sourceType) { for(GetterFactoryProperty getterFactoryProperty : lookForAll(GetterFactoryProperty.class)) { if (getterFactoryProperty.getSourceType() == null || TypeHelper.isAssignable(getterFactoryProperty.getSourceType(), sourceType)) { return (GetterFactory<?, K>) getterFactoryProperty.getGetterFactory(); } } return null; }