Skip to content

Commit

Permalink
Simplify isPropertySet and remove redundant code (#3530)
Browse files Browse the repository at this point in the history
* Simplify ZooBasedConfiguration's implementation of isPropertySet, and
* Remove TableConfiguration's redundant implementation, as it's the same
  as its super class (it just didn't look the same until it was
  simplified)
  • Loading branch information
ctubbsii committed Jun 23, 2023
1 parent 838cd3d commit 05e4693
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,6 @@ public TableConfiguration(ServerContext context, TableId tableId, NamespaceConfi
newDeriver(conf -> createCryptoService(conf, tableId, context.getCryptoFactory()));
}

@Override
public boolean isPropertySet(Property prop) {
if (_isPropertySet(prop)) {
return true;
}

return getParent().isPropertySet(prop);
}

private boolean _isPropertySet(Property property) {
Map<String,String> propMap = getSnapshot();
return propMap.get(property.getKey()) != null;
}

@Override
public String get(Property property) {
String value = _get(property);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,7 @@ public void getProperties(final Map<String,String> props, final Predicate<String

@Override
public boolean isPropertySet(final Property property) {

Map<String,String> theseProps = getSnapshot();

if (theseProps.get(property.getKey()) != null) {
return true;
}

return getParent().isPropertySet(property);

return getSnapshot().get(property.getKey()) != null || getParent().isPropertySet(property);
}

public @NonNull Map<String,String> getSnapshot() {
Expand Down

0 comments on commit 05e4693

Please sign in to comment.