Skip to content
This repository has been archived by the owner on Jan 27, 2025. It is now read-only.

Commit

Permalink
Integrate feedback from PR #83 (see #66)
Browse files Browse the repository at this point in the history
Co-authored-by: Jens Wille <[email protected]>
  • Loading branch information
fsteeg and blackwinter committed Dec 3, 2021
1 parent dd0f354 commit a70a7b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private void processBind(final Do theDo, final EList<String> params) {
// w/o var -> use the currently bound value as the record:
else {
if (value.isHash()) {
final Record fullRecord = record.shallowClone();
final Record fullRecord = record;
record = new Record();
record.addAll(value.asHash());
processSubexpressions(theDo.getElements());
Expand All @@ -114,7 +114,7 @@ record = fullRecord;
}
else {
// TODO: bind to arrays (if that makes sense) and strings (access with '.')
throw new IllegalStateException(Value.UNEXPECTED + value);
throw new IllegalStateException("expected hash, got " + value);
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions metafix/src/main/java/org/metafacture/metafix/Value.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* or a {@link java.lang.String String}.
*/
public class Value {
/*package-private*/ static final String UNEXPECTED = "expected array or hash, got ";

/*package-private*/ static final String APPEND_FIELD = "$append";
private static final String LAST_FIELD = "$last";
private static final String ASTERISK = "*";
Expand Down Expand Up @@ -420,8 +420,8 @@ private void insert(final InsertMode mode, final String[] fields, final String n
}
}

/*package-private*/ void set(final int i, final Value value) {
list.set(i, value);
/*package-private*/ void set(final int index, final Value value) {
list.set(index, value);
}

}
Expand All @@ -433,6 +433,8 @@ public static class Hash extends AbstractValueType {

private static final String FIELD_PATH_SEPARATOR = "\\.";

private static final String UNEXPECTED = "expected array or hash, got ";

private final Map<String, Value> map = new LinkedHashMap<>();

/**
Expand Down

0 comments on commit a70a7b8

Please sign in to comment.