|
|
@ -43,6 +43,10 @@ public abstract class PathToken { |
|
|
|
String evalPath = Utils.concat(currentPath, "['", property, "']"); |
|
|
|
String evalPath = Utils.concat(currentPath, "['", property, "']"); |
|
|
|
Object propertyVal = readObjectProperty(property, model, ctx); |
|
|
|
Object propertyVal = readObjectProperty(property, model, ctx); |
|
|
|
if(propertyVal == JsonProvider.UNDEFINED){ |
|
|
|
if(propertyVal == JsonProvider.UNDEFINED){ |
|
|
|
|
|
|
|
// Conditions below heavily depend on current token type (and its logic) and are not "universal",
|
|
|
|
|
|
|
|
// so this code is quite dangerous. Better safe than sorry.
|
|
|
|
|
|
|
|
assert this instanceof PropertyPathToken : "only PropertyPathToken is supported"; |
|
|
|
|
|
|
|
|
|
|
|
if(isLeaf()) { |
|
|
|
if(isLeaf()) { |
|
|
|
if(ctx.options().contains(Option.DEFAULT_PATH_LEAF_TO_NULL)){ |
|
|
|
if(ctx.options().contains(Option.DEFAULT_PATH_LEAF_TO_NULL)){ |
|
|
|
propertyVal = null; |
|
|
|
propertyVal = null; |
|
|
@ -149,15 +153,10 @@ public abstract class PathToken { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isUpstreamDefinite() { |
|
|
|
public boolean isUpstreamDefinite() { |
|
|
|
if(upstreamDefinite != null){ |
|
|
|
if (upstreamDefinite == null) { |
|
|
|
return upstreamDefinite.booleanValue(); |
|
|
|
upstreamDefinite = isRoot() || prev.isTokenDefinite() && prev.isUpstreamDefinite(); |
|
|
|
} |
|
|
|
|
|
|
|
boolean isUpstreamDefinite = isTokenDefinite(); |
|
|
|
|
|
|
|
if (isUpstreamDefinite && !isRoot()) { |
|
|
|
|
|
|
|
isUpstreamDefinite = prev.isUpstreamDefinite(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
upstreamDefinite = isUpstreamDefinite; |
|
|
|
return upstreamDefinite; |
|
|
|
return isUpstreamDefinite; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int getTokenCount() { |
|
|
|
public int getTokenCount() { |
|
|
|