@Override public void manualMatch(PropertyMeta<?, ?> prop) { if (prop.isConstructorProperty()) { removeNonMatching(((ConstructorPropertyMeta) prop).getParameter()); } super.manualMatch(prop); }
public void forEachConstructorProperties(ForEachCallBack<PropertyMapping<T, ?, K>> handler) { modifiable = false; for (PropertyMapping<T, ?, K> property : properties) { if (property != null) { PropertyMeta<T, ?> propertyMeta = property.getPropertyMeta(); if (propertyMeta != null && propertyMeta.isConstructorProperty() && ! propertyMeta.isSubProperty()) { handler.handle(property); } } } }
@Override public void manualMatch(PropertyMeta<?, ?> prop) { if (prop.isConstructorProperty()) { removeNonMatching(((ConstructorPropertyMeta) prop).getParameter()); } super.manualMatch(prop); }
public void forEachConstructorProperties(ForEachCallBack<PropertyMapping<T, ?, K>> handler) { modifiable = false; for (PropertyMapping<T, ?, K> property : properties) { if (property != null) { PropertyMeta<T, ?> propertyMeta = property.getPropertyMeta(); if (propertyMeta != null && propertyMeta.isConstructorProperty() && ! propertyMeta.isSubProperty()) { handler.handle(property); } } } }
private int compare(PropertyMeta<?, ?> p1, PropertyMeta<?, ?> p2) { if (p1.isConstructorProperty()) { if (!p2.isConstructorProperty()) { return -1; } } else if (p2.isConstructorProperty()) { return 1; } else if (!p1.isSelf()) { if (p2.isSelf()) { return -1; } } else if (!p2.isSelf()) { return 1; } else if (!p1.isSubProperty()) { if (p2.isSubProperty()) { return -1; } } else if (!p2.isSubProperty()) { return 1; } return getterSetterCompare(p1, p2); }
private int compare(PropertyMeta<?, ?> p1, PropertyMeta<?, ?> p2) { if (p1.isConstructorProperty()) { if (!p2.isConstructorProperty()) { return -1; } } else if (p2.isConstructorProperty()) { return 1; } else if (!p1.isSelf()) { if (p2.isSelf()) { return -1; } } else if (!p2.isSelf()) { return 1; } else if (!p1.isSubProperty()) { if (p2.isSubProperty()) { return -1; } } else if (!p2.isSubProperty()) { return 1; } return getterSetterCompare(p1, p2); }
if (e.owner.isConstructorProperty()) { ConstructorPropertyMeta<T, ?> meta = (ConstructorPropertyMeta<T, ?>) e.owner; injectionParams.add(new SubPropertyParam(meta.getParameter(), meta, e.propertyMappings, this));
if (e.owner.isConstructorProperty()) { ConstructorPropertyMeta<T, ?> meta = (ConstructorPropertyMeta<T, ?>) e.owner; injectionParams.add(new SubPropertyParam(meta.getParameter(), meta, e.propertyMappings, this));
if (!e.owner.isConstructorProperty()) { final MappingContextFactoryBuilder currentBuilder = getMapperContextFactoryBuilder(e.owner, e.propertyMappings);
if (!e.owner.isConstructorProperty()) { final MappingContextFactoryBuilder currentBuilder = getMapperContextFactoryBuilder(e.owner, e.propertyMappings);
@Override public boolean test(PropertyMeta<?, ?> propertyMeta) { if (propertyMeta.isSelf()) { return true; } if (!NullSetter.isNull(propertyMeta.getSetter())) { return true; } if (propertyMeta.isConstructorProperty()) { return true; } if (propertyMeta.isSubProperty()) { SubPropertyMeta subPropertyMeta = (SubPropertyMeta) propertyMeta; if (subPropertyMeta.getOwnerProperty().isConstructorProperty() || !NullSetter.isNull(subPropertyMeta.getOwnerProperty().getSetter())) { return test(subPropertyMeta.getSubProperty()); } } return false; } }
@Override public boolean test(PropertyMeta<?, ?> propertyMeta) { if (propertyMeta.isSelf()) { return true; } if (!NullSetter.isNull(propertyMeta.getSetter())) { return true; } if (propertyMeta.isConstructorProperty()) { return true; } if (propertyMeta.isSubProperty()) { SubPropertyMeta subPropertyMeta = (SubPropertyMeta) propertyMeta; if (subPropertyMeta.getOwnerProperty().isConstructorProperty() || !NullSetter.isNull(subPropertyMeta.getOwnerProperty().getSetter())) { return test(subPropertyMeta.getSubProperty()); } } return false; } }
@Test public void testResolveConstructorParamWithDeductorNoNullInParam() { ClassMeta<TwoStringObjectNonNull> classMeta = ReflectionService.disableAsm().getClassMeta(TwoStringObjectNonNull.class); assertTrue(classMeta.newPropertyFinder().findProperty(DefaultPropertyNameMatcher.of("value"), new Object[0], (TypeAffinity)null, propertyFilter).isConstructorProperty()); assertTrue(classMeta.newPropertyFinder().findProperty(DefaultPropertyNameMatcher.of("value2"), new Object[0], (TypeAffinity)null, propertyFilter).isConstructorProperty()); }
@Test public void testResolveConstructorParamWithDeductorNoNull() { ClassMeta<NonNullContainer> classMeta = ReflectionService.disableAsm().getClassMeta(NonNullContainer.class); assertTrue(classMeta.newPropertyFinder().findProperty(DefaultPropertyNameMatcher.of("value"), new Object[0], (TypeAffinity)null, propertyFilter).isConstructorProperty()); assertTrue(classMeta.newPropertyFinder().findProperty(DefaultPropertyNameMatcher.of("value2"), new Object[0], (TypeAffinity)null, propertyFilter).isConstructorProperty()); }
@Test public void testResolveConstructorParamWithDeductor() { ClassMeta<StringObject> classMeta = ReflectionService.disableAsm().getClassMeta(StringObject.class); assertTrue(classMeta.newPropertyFinder().findProperty(DefaultPropertyNameMatcher.of("value"), new Object[0], (TypeAffinity)null, propertyFilter).isConstructorProperty()); }
@Test public void testDisableAsmResolvedConstructorParamName() { ClassMeta<DbFinalObject> classMeta = ReflectionService.disableAsm().getClassMeta(DbFinalObject.class); PropertyMeta<DbFinalObject, ?> property = classMeta.newPropertyFinder().findProperty(DefaultPropertyNameMatcher.of("id"), new Object[0], (TypeAffinity)null, isValidPropertyMeta); assertTrue(property.isConstructorProperty()); }