@Override public boolean test(FieldKey<?> fieldKey) { return fieldKey.getName().equalsIgnoreCase(name); }
@Override public boolean test(FieldKey<?> fieldKey) { return fieldKey.getName().equalsIgnoreCase(name); }
@Override public void map(FieldKey key, ColumnDefinition columnDefinition, PropertyMeta<?, ?> prop) { if (DEBUG) { String path = prop.getPath(); System.out.println("PropertyMappingsBuilder - map " + key.getName() + " to " + path); } }
@Override public void map(FieldKey key, ColumnDefinition columnDefinition, PropertyMeta<?, ?> prop) { if (DEBUG) { String path = prop.getPath(); System.out.println("PropertyMappingsBuilder - map " + key.getName() + " to " + path); } }
@Override public PropertyNameMatcher newInstance(FieldKey<?> key) { return new DefaultPropertyNameMatcher(key.getName(), 0, exactMatch, caseSensitive); }
@Override public PropertyNameMatcher newInstance(FieldKey<?> key) { return new DefaultPropertyNameMatcher(key.getName(), 0, exactMatch, caseSensitive); }
private boolean checkTypeCompatibility(K key, Type customSourceReturnType, Type propertyMetaType) { if (customSourceReturnType == null) { // cannot determine type return true; } else if(!areCompatible(propertyMetaType, customSourceReturnType)) { _mapperBuilderErrorHandler.customFieldError(key, "Incompatible customReader on '" + key.getName()+ "' type " + customSourceReturnType + " expected " + propertyMetaType ); return false; } return true; }
private boolean checkTypeCompatibility(K key, Type customSourceReturnType, Type propertyMetaType) { if (customSourceReturnType == null) { // cannot determine type return true; } else if(!areCompatible(propertyMetaType, customSourceReturnType)) { _mapperBuilderErrorHandler.customFieldError(key, "Incompatible customReader on '" + key.getName()+ "' type " + customSourceReturnType + " expected " + propertyMetaType ); return false; } return true; }
public <K extends FieldKey<K>> K apply(K key) { return key.alias(renameFunction.apply(key.getName())); }
public <K extends FieldKey<K>> K apply(K key) { return key.alias(renameFunction.apply(key.getName())); }
private void handleSelfPropertyMetaInvalidation(MapperBuilderErrorHandler errorHandler) { List<K> invalidateKeys = new ArrayList<K>(); for(ListIterator<PropertyMapping<T, ?, K>> iterator = properties.listIterator(); iterator.hasNext();) { PropertyMapping<T, ?, K> propertyMapping = iterator.next(); if (propertyMapping != null && !propertyMapping.getPropertyMeta().isValid()) { iterator.set(null); if (!propertyMapping.getColumnDefinition().has(OptionalProperty.class)) { invalidateKeys.add(propertyMapping.getColumnKey()); } } } for(K k : invalidateKeys) { errorHandler.propertyNotFound(classMeta.getType(), k.getName()); } }
private void handleSelfPropertyMetaInvalidation(MapperBuilderErrorHandler errorHandler) { List<K> invalidateKeys = new ArrayList<K>(); for(ListIterator<PropertyMapping<T, ?, K>> iterator = properties.listIterator(); iterator.hasNext();) { PropertyMapping<T, ?, K> propertyMapping = iterator.next(); if (propertyMapping != null && !propertyMapping.getPropertyMeta().isValid()) { iterator.set(null); if (!propertyMapping.getColumnDefinition().has(OptionalProperty.class)) { invalidateKeys.add(propertyMapping.getColumnKey()); } } } for(K k : invalidateKeys) { errorHandler.propertyNotFound(classMeta.getType(), k.getName()); } }
AccessorNotFound accessorNotFound = selectAccessotNotFound(accessorNotFounds); if (accessorNotFound == null) { mapperBuilderErrorHandler.propertyNotFound(classMeta.getType(), key.getName()); } else { mapperBuilderErrorHandler.accessorNotFound(accessorNotFounds.iterator().next().toString());
AccessorNotFound accessorNotFound = selectAccessotNotFound(accessorNotFounds); if (accessorNotFound == null) { mapperBuilderErrorHandler.propertyNotFound(classMeta.getType(), key.getName()); } else { mapperBuilderErrorHandler.accessorNotFound(accessorNotFounds.iterator().next().toString());
@SuppressWarnings("unchecked") public B addColumn(K key, FieldMapperColumnDefinition<K> columnDefinition) { final FieldMapperColumnDefinition<K> composedDefinition = columnDefinition.compose(mapperConfig.columnDefinitions().getColumnDefinition(key)); final K mappedColumnKey = composedDefinition.rename(key); if (composedDefinition.has(ConstantValueProperty.class)) { ConstantValueProperty staticValueProperty = composedDefinition.lookFor(ConstantValueProperty.class); PropertyMeta<T, Object> meta = new ObjectPropertyMeta<T, Object>(key.getName(), classMeta.getType(), reflectionService, staticValueProperty.getType(), ScoredGetter.of(new ConstantGetter<T, Object>(staticValueProperty.getValue()), 1), null, null); propertyMappingsBuilder.addProperty(key, columnDefinition, meta); } else { propertyMappingsBuilder.addProperty(mappedColumnKey, composedDefinition); } return (B) this; }
@SuppressWarnings("unchecked") public B addColumn(K key, FieldMapperColumnDefinition<K> columnDefinition) { final FieldMapperColumnDefinition<K> composedDefinition = columnDefinition.compose(mapperConfig.columnDefinitions().getColumnDefinition(key)); final K mappedColumnKey = composedDefinition.rename(key); if (composedDefinition.has(ConstantValueProperty.class)) { ConstantValueProperty staticValueProperty = composedDefinition.lookFor(ConstantValueProperty.class); PropertyMeta<T, Object> meta = new ObjectPropertyMeta<T, Object>(key.getName(), classMeta.getType(), reflectionService, staticValueProperty.getType(), ScoredGetter.of(new ConstantGetter<T, Object>(staticValueProperty.getValue()), 1), null, null); propertyMappingsBuilder.addProperty(key, columnDefinition, meta); } else { propertyMappingsBuilder.addProperty(mappedColumnKey, composedDefinition); } return (B) this; }