throw new InvalidModelException();
}
private void setTargetObject(JsonPath jsonPath, Object newValue) {
JsonPath setterPath = jsonPath.copy();
PathToken pathToken = setterPath.getTokenizer().removeLastPathToken();
if (pathToken.isRootToken()) {
if (this instanceof JsonSubModel) {
JsonSubModel thisModel = (JsonSubModel) this;
thisModel.parent.setTargetObject(thisModel.subModelPath, newValue);
} else {
this.jsonObject = newValue;
}
} else {
if (pathToken.isArrayIndexToken()) {
int arrayIndex = pathToken.getArrayIndex();
opsForArray(setterPath).set(arrayIndex, newValue);
} else {
opsForObject(setterPath).put(pathToken.getFragment(), newValue);
}
}
}