Skip to content

Commit

Permalink
fix: renamed SettableBeanPropertyDelegate to SettableBeanPropertyDele…
Browse files Browse the repository at this point in the history
…gating

Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa authored Oct 23, 2024
1 parent e0a0dbb commit 485a3c5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* Fix #6138: Removed unused `io:fabric8:kubernetes-model` artifact
* Fix #6156: Removed deprecated extension `io:fabric8:service-catalog`
* Fix #6158: Removed deprecated methods from `io.fabric8.kubernetes.client.utils.IOHelpers`
* Fix #6361: Renamed SettableBeanPropertyDelegate to SettableBeanPropertyDelegating

### 6.13.4 (2024-09-25)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*
* <p>
* This BeanPropertyWriter implementation is intended to be used in combination with
* the {@link SettableBeanPropertyDelegate} to allow the propagation of deserialized properties that don't match the
* the {@link SettableBeanPropertyDelegating} to allow the propagation of deserialized properties that don't match the
* target field types.
*/
public class BeanPropertyWriterDelegate extends BeanPropertyWriter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
* A fall-back mechanism is implemented in the deserializeAndSet methods to allow field values that don't match the
* target type to be preserved in the anySetter method if exists.
*/
public class SettableBeanPropertyDelegate extends SettableBeanProperty.Delegating {
public class SettableBeanPropertyDelegating extends SettableBeanProperty.Delegating {

private final SettableAnyProperty anySetter;
private final transient BooleanSupplier useAnySetter;

SettableBeanPropertyDelegate(SettableBeanProperty delegate, SettableAnyProperty anySetter, BooleanSupplier useAnySetter) {
SettableBeanPropertyDelegating(SettableBeanProperty delegate, SettableAnyProperty anySetter, BooleanSupplier useAnySetter) {
super(delegate);
this.anySetter = anySetter;
this.useAnySetter = useAnySetter;
Expand All @@ -55,7 +55,7 @@ public class SettableBeanPropertyDelegate extends SettableBeanProperty.Delegatin
*/
@Override
protected SettableBeanProperty withDelegate(SettableBeanProperty d) {
return new SettableBeanPropertyDelegate(d, anySetter, useAnySetter);
return new SettableBeanPropertyDelegating(d, anySetter, useAnySetter);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public UnmatchedFieldTypeModule(boolean logWarnings, boolean restrictToTemplates
public BeanDeserializerBuilder updateBuilder(DeserializationConfig config, BeanDescription beanDesc,
BeanDeserializerBuilder builder) {
builder.getProperties().forEachRemaining(p -> builder.addOrReplaceProperty(
new SettableBeanPropertyDelegate(p, builder.getAnySetter(), UnmatchedFieldTypeModule.this::useAnySetter) {
new SettableBeanPropertyDelegating(p, builder.getAnySetter(), UnmatchedFieldTypeModule.this::useAnySetter) {
}, true));
return builder;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

class SettableBeanPropertyDelegateTest {
class SettableBeanPropertyDelegatingTest {

private AtomicBoolean useAnySetter;
private ObjectMapper objectMapper;
private DefaultDeserializationContext deserializationContext;
private SettableAnyProperty anySetter;
private SettableBeanProperty intFieldProperty;
private SettableBeanPropertyDelegate intFieldPropertyDelegating;
private SettableBeanPropertyDelegating intFieldPropertyDelegating;

@BeforeEach
void setUp() throws Exception {
Expand Down Expand Up @@ -104,7 +104,7 @@ void setUp() throws Exception {
intFieldProperty = testBeanDeserializer.findProperty("intField")
.withValueDeserializer(NumberDeserializers.find(int.class, null));
// Delegating SettableBeanProperty in test
intFieldPropertyDelegating = new SettableBeanPropertyDelegate(intFieldProperty, anySetter, useAnySetter::get);
intFieldPropertyDelegating = new SettableBeanPropertyDelegating(intFieldProperty, anySetter, useAnySetter::get);

}

Expand All @@ -115,11 +115,11 @@ void withValueDeserializer() {
final SettableBeanProperty result = intFieldPropertyDelegating.withValueDeserializer(null);
// Then
assertThat(result)
.isInstanceOf(SettableBeanPropertyDelegate.class)
.isInstanceOf(SettableBeanPropertyDelegating.class)
.isNotSameAs(intFieldPropertyDelegating)
.hasFieldOrPropertyWithValue("anySetter", anySetter)
.asInstanceOf(InstanceOfAssertFactories.type(SettableBeanPropertyDelegate.class))
.extracting(SettableBeanPropertyDelegate::getDelegate)
.asInstanceOf(InstanceOfAssertFactories.type(SettableBeanPropertyDelegating.class))
.extracting(SettableBeanPropertyDelegating::getDelegate)
.isInstanceOf(CreatorProperty.class)
.isNotSameAs(intFieldProperty)
.hasFieldOrPropertyWithValue("name", "intField");
Expand All @@ -132,11 +132,11 @@ void withName() {
final SettableBeanProperty result = intFieldPropertyDelegating.withName(new PropertyName("overriddenName"));
// Then
assertThat(result)
.isInstanceOf(SettableBeanPropertyDelegate.class)
.isInstanceOf(SettableBeanPropertyDelegating.class)
.isNotSameAs(intFieldPropertyDelegating)
.hasFieldOrPropertyWithValue("anySetter", anySetter)
.asInstanceOf(InstanceOfAssertFactories.type(SettableBeanPropertyDelegate.class))
.extracting(SettableBeanPropertyDelegate::getDelegate)
.asInstanceOf(InstanceOfAssertFactories.type(SettableBeanPropertyDelegating.class))
.extracting(SettableBeanPropertyDelegating::getDelegate)
.isInstanceOf(CreatorProperty.class)
.isNotSameAs(intFieldProperty)
.hasFieldOrPropertyWithValue("name", "overriddenName");
Expand All @@ -149,11 +149,11 @@ void withNullProvider() {
final SettableBeanProperty result = intFieldPropertyDelegating.withNullProvider(null);
// Then
assertThat(result)
.isInstanceOf(SettableBeanPropertyDelegate.class)
.isInstanceOf(SettableBeanPropertyDelegating.class)
.isNotSameAs(intFieldPropertyDelegating)
.hasFieldOrPropertyWithValue("anySetter", anySetter)
.asInstanceOf(InstanceOfAssertFactories.type(SettableBeanPropertyDelegate.class))
.extracting(SettableBeanPropertyDelegate::getDelegate)
.asInstanceOf(InstanceOfAssertFactories.type(SettableBeanPropertyDelegating.class))
.extracting(SettableBeanPropertyDelegating::getDelegate)
.isInstanceOf(CreatorProperty.class)
.isNotSameAs(intFieldProperty)
.hasFieldOrPropertyWithValue("name", "intField");
Expand Down Expand Up @@ -201,7 +201,7 @@ void fixAccess() {
.findProperty(PropertyName.construct("intField"));
final SettableBeanProperty fieldProperty = new FieldProperty(testPropertyFieldDefinition, testBeanJavaType, null,
testBeanDescription.getClassAnnotations(), testPropertyFieldDefinition.getField());
final SettableBeanProperty fieldPropertyDelegating = new SettableBeanPropertyDelegate(fieldProperty, anySetter,
final SettableBeanProperty fieldPropertyDelegating = new SettableBeanPropertyDelegating(fieldProperty, anySetter,
useAnySetter::get);
assertThat(((AccessibleObject) fieldProperty.getMember().getMember()).isAccessible()).isFalse();
// When
Expand Down Expand Up @@ -274,7 +274,7 @@ public PropertyName findWrapperName(Annotated ann) {
.findProperty(PropertyName.construct("intField"));
final SettableBeanProperty fieldProperty = new FieldProperty(testPropertyFieldDefinition, testBeanJavaType, null,
testBeanDescription.getClassAnnotations(), testPropertyFieldDefinition.getField());
final SettableBeanProperty fieldPropertyDelegating = new SettableBeanPropertyDelegate(fieldProperty, anySetter,
final SettableBeanProperty fieldPropertyDelegating = new SettableBeanPropertyDelegating(fieldProperty, anySetter,
useAnySetter::get);
// When
final PropertyName result = fieldPropertyDelegating.getWrapperName();
Expand Down Expand Up @@ -458,7 +458,7 @@ void deserializeSetAndReturnWithExceptionNotUsingAnySetter() throws IOException
@Test
@DisplayName("deserializeSetAndReturn, with anySetter=null and throws Exception, should throw Exception")
void deserializeSetAndReturnWithExceptionAndNullAnySetter() throws IOException {
intFieldPropertyDelegating = new SettableBeanPropertyDelegate(intFieldProperty, null, () -> true);
intFieldPropertyDelegating = new SettableBeanPropertyDelegating(intFieldProperty, null, () -> true);
try (JsonParser parser = objectMapper.createParser("\"${a-placeholder}\"")) {
final DefaultDeserializationContext ctx = deserializationContext
.createInstance(deserializationContext.getConfig(), parser, null);
Expand Down Expand Up @@ -486,7 +486,7 @@ void allMethodsFromSuperclassAreImplementedByDelegatingClass() {
.collect(Collectors.toMap(ms -> ms, ms -> false));
Stream.concat(
Stream.of(SettableBeanProperty.Delegating.class.getDeclaredMethods()),
Stream.of(SettableBeanPropertyDelegate.class.getDeclaredMethods()))
Stream.of(SettableBeanPropertyDelegating.class.getDeclaredMethods()))
.map(MethodSignature::from)
.forEach(ms -> superclassMethods.computeIfPresent(ms, (k, v) -> true));
assertThat(superclassMethods)
Expand Down

0 comments on commit 485a3c5

Please sign in to comment.