use of org.simpleflatmapper.reflect.meta.PropertyNameMatcher in project SimpleFlatMapper by arnaudroger.
the class PropertyMappingsBuilder method _addProperty.
@SuppressWarnings("unchecked")
private <P> PropertyMapping<T, P, K, D> _addProperty(final K key, final D columnDefinition, Consumer<? super K> propertyNotFound) {
if (!modifiable)
throw new IllegalStateException("Builder not modifiable");
if (columnDefinition.ignore()) {
propertyMappingsBuilderProbe.ignore(key, columnDefinition);
properties.add(null);
return null;
}
PropertyFinder<T> effectivePropertyFinder = wrapPropertyFinder(this.propertyFinder);
PropertyNameMatcher propertyNameMatcher = propertyNameMatcherFactory.newInstance(key);
final PropertyMeta<T, P> prop = (PropertyMeta<T, P>) effectivePropertyFinder.findProperty(propertyNameMatcher, columnDefinition.properties(), propertyMappingsBuilderProbe.propertyFinderProbe(propertyNameMatcher));
if (prop == null) {
propertyNotFound.accept(key);
properties.add(null);
return null;
} else {
PropertyMapping<T, P, K, D> propertyMapping = addProperty(key, columnDefinition, prop);
propertyMappingsBuilderProbe.map(key, columnDefinition, prop);
handleSelfPropertyMetaInvalidation(propertyNotFound);
return propertyMapping;
}
}
use of org.simpleflatmapper.reflect.meta.PropertyNameMatcher in project SimpleFlatMapper by arnaudroger.
the class DefaultPropertyNameMatcherTest method testStartOf.
@Test
public void testStartOf() {
PropertyNameMatcher matcher = new DefaultPropertyNameMatcher("my_Col_top_bottom", 0, false, false);
assertTrue(matcher.partialMatch("myCol").getLeftOverMatcher().partialMatch("top").getLeftOverMatcher().matches("bottom"));
assertTrue(matcher.partialMatch("my_Col").getLeftOverMatcher().partialMatch("tOp").getLeftOverMatcher().matches("bottom"));
assertTrue(matcher.partialMatch("my Col").getLeftOverMatcher().partialMatch("tOp").getLeftOverMatcher().matches("bottom"));
assertNull(matcher.partialMatch("my__Col"));
assertNull(matcher.partialMatch("myCol2"));
}
use of org.simpleflatmapper.reflect.meta.PropertyNameMatcher in project SimpleFlatMapper by arnaudroger.
the class DefaultPropertyNameMatcherTest method testFullMatchCaseSensitive.
@Test
public void testFullMatchCaseSensitive() {
PropertyNameMatcher matcher = new DefaultPropertyNameMatcher("my_col", 0, false, true);
assertTrue(matcher.matches("myCol"));
assertFalse(matcher.matches("mycol"));
}
use of org.simpleflatmapper.reflect.meta.PropertyNameMatcher in project SimpleFlatMapper by arnaudroger.
the class DefaultPropertyNameMatcherTest method testFullMatchExactMath.
@Test
public void testFullMatchExactMath() {
PropertyNameMatcher matcher = new DefaultPropertyNameMatcher("my_col", 0, true, false);
assertTrue(matcher.matches("my_col"));
assertTrue(matcher.matches("my_COL"));
assertFalse(matcher.matches("myCol"));
}
use of org.simpleflatmapper.reflect.meta.PropertyNameMatcher in project SimpleFlatMapper by arnaudroger.
the class DefaultPropertyNameMatcherTest method testFullMatch.
@Test
public void testFullMatch() {
PropertyNameMatcher matcher = new DefaultPropertyNameMatcher("my_Col", 0, false, false);
assertTrue(matcher.matches("myCol"));
assertTrue(matcher.matches("my_Col"));
assertTrue(matcher.matches("my Col"));
assertFalse(matcher.matches("myCo"));
assertFalse(matcher.matches("my__Col"));
assertFalse(matcher.matches("myCol2"));
}
Aggregations