|
|
@ -17,6 +17,9 @@ public abstract class PathRef implements Comparable<PathRef> { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void set(Object newVal, Configuration configuration) {} |
|
|
|
public void set(Object newVal, Configuration configuration) {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void convert(ValueConverter valueConverter, Configuration configuration) {} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void delete(Configuration configuration) {} |
|
|
|
public void delete(Configuration configuration) {} |
|
|
|
|
|
|
|
|
|
|
@ -42,6 +45,8 @@ public abstract class PathRef implements Comparable<PathRef> { |
|
|
|
|
|
|
|
|
|
|
|
public abstract void set(Object newVal, Configuration configuration); |
|
|
|
public abstract void set(Object newVal, Configuration configuration); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public abstract void convert(ValueConverter valueConverter, Configuration configuration); |
|
|
|
|
|
|
|
|
|
|
|
public abstract void delete(Configuration configuration); |
|
|
|
public abstract void delete(Configuration configuration); |
|
|
|
|
|
|
|
|
|
|
|
public abstract void add(Object newVal, Configuration configuration); |
|
|
|
public abstract void add(Object newVal, Configuration configuration); |
|
|
@ -103,6 +108,10 @@ public abstract class PathRef implements Comparable<PathRef> { |
|
|
|
throw new InvalidModificationException("Invalid delete operation"); |
|
|
|
throw new InvalidModificationException("Invalid delete operation"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void convert(ValueConverter valueConverter, Configuration configuration){ |
|
|
|
|
|
|
|
throw new InvalidModificationException("Invalid convert operation"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void delete(Configuration configuration) { |
|
|
|
public void delete(Configuration configuration) { |
|
|
|
throw new InvalidModificationException("Invalid delete operation"); |
|
|
|
throw new InvalidModificationException("Invalid delete operation"); |
|
|
@ -136,6 +145,7 @@ public abstract class PathRef implements Comparable<PathRef> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static class ArrayIndexPathRef extends PathRef { |
|
|
|
private static class ArrayIndexPathRef extends PathRef { |
|
|
|
|
|
|
|
|
|
|
|
private int index; |
|
|
|
private int index; |
|
|
@ -151,6 +161,11 @@ public abstract class PathRef implements Comparable<PathRef> { |
|
|
|
configuration.jsonProvider().setArrayIndex(parent, index, newVal); |
|
|
|
configuration.jsonProvider().setArrayIndex(parent, index, newVal); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void convert(ValueConverter valueConverter, Configuration configuration){ |
|
|
|
|
|
|
|
Object currentValue = configuration.jsonProvider().getArrayIndex(parent, index); |
|
|
|
|
|
|
|
configuration.jsonProvider().setArrayIndex(parent, index, valueConverter.convert(currentValue)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void delete(Configuration configuration){ |
|
|
|
public void delete(Configuration configuration){ |
|
|
|
configuration.jsonProvider().removeProperty(parent, value); |
|
|
|
configuration.jsonProvider().removeProperty(parent, value); |
|
|
|
} |
|
|
|
} |
|
|
@ -209,6 +224,13 @@ public abstract class PathRef implements Comparable<PathRef> { |
|
|
|
configuration.jsonProvider().setProperty(parent, property, newVal); |
|
|
|
configuration.jsonProvider().setProperty(parent, property, newVal); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void convert(ValueConverter valueConverter, Configuration configuration) { |
|
|
|
|
|
|
|
Object currentValue = configuration.jsonProvider().getMapValue(parent, property); |
|
|
|
|
|
|
|
configuration.jsonProvider().setProperty(parent, property, valueConverter.convert(currentValue)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void delete(Configuration configuration){ |
|
|
|
public void delete(Configuration configuration){ |
|
|
|
configuration.jsonProvider().removeProperty(parent, property); |
|
|
|
configuration.jsonProvider().removeProperty(parent, property); |
|
|
|
} |
|
|
|
} |
|
|
@ -266,6 +288,12 @@ public abstract class PathRef implements Comparable<PathRef> { |
|
|
|
configuration.jsonProvider().setProperty(parent, property, newVal); |
|
|
|
configuration.jsonProvider().setProperty(parent, property, newVal); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void convert(ValueConverter valueConverter, Configuration configuration) { |
|
|
|
|
|
|
|
for (String property : properties) { |
|
|
|
|
|
|
|
Object currentValue = configuration.jsonProvider().getMapValue(parent, property); |
|
|
|
|
|
|
|
configuration.jsonProvider().setProperty(parent, property, valueConverter.convert(currentValue)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void delete(Configuration configuration){ |
|
|
|
public void delete(Configuration configuration){ |
|
|
|
for (String property : properties) { |
|
|
|
for (String property : properties) { |
|
|
|