diff --git a/metafix/src/main/java/org/metafacture/metafix/RecordTransformer.java b/metafix/src/main/java/org/metafacture/metafix/RecordTransformer.java index b3a8146a..f49162ed 100644 --- a/metafix/src/main/java/org/metafacture/metafix/RecordTransformer.java +++ b/metafix/src/main/java/org/metafacture/metafix/RecordTransformer.java @@ -105,7 +105,7 @@ private void processBind(final Do theDo, final EList 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()); @@ -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); } } } diff --git a/metafix/src/main/java/org/metafacture/metafix/Value.java b/metafix/src/main/java/org/metafacture/metafix/Value.java index 74983057..fc20dc45 100644 --- a/metafix/src/main/java/org/metafacture/metafix/Value.java +++ b/metafix/src/main/java/org/metafacture/metafix/Value.java @@ -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 = "*"; @@ -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); } } @@ -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 map = new LinkedHashMap<>(); /**