Skip to content

Commit

Permalink
moved object transformation to transformObject
Browse files Browse the repository at this point in the history
  • Loading branch information
pietro-lopes committed Aug 18, 2024
1 parent e77181c commit 9087fa0
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,26 +91,25 @@ public Attribute createObject() {
throw new IllegalArgumentException("Not possible to create a Boolean or Ranged Attribute. Use bool() or range() methods.");
}

var attribute = Either.unwrap(defaultValue.mapBoth(
return Either.unwrap(defaultValue.mapBoth(
l -> new RangedAttribute(this.getBuilderTranslationKey(), l.defaultValue, l.min, l.max),
r -> new BooleanAttribute(this.getBuilderTranslationKey(), r))
);
}

@Override
public Attribute transformObject(Attribute attribute) {
if (syncable) {
attribute.setSyncable(true);
}

if (sentiment != null) {
attribute.setSentiment(sentiment);
}
return attribute;
}

@Override
public Attribute transformObject(Attribute obj) {
if (predicateList.isEmpty()) {
predicateList.add(Predicates.alwaysTrue());
}
return obj;
return attribute;
}
}

0 comments on commit 9087fa0

Please sign in to comment.