Object value = getValueIn(ctx.data, name, line); return checkForMissing(name, line, missingIsNull, value); Object value = getValueIn(pctx.data, name, line); if (value != NO_FETCHER_FOUND) return value;
/** * Decomposes the compound key {@code name} into components and resolves the value they * reference. */ protected Object getCompoundValue (Context ctx, String name, int line, boolean missingIsNull) { String[] comps = name.split("\\."); // we want to allow the first component of a compound key to be located in a parent // context, but once we're selecting sub-components, they must only be resolved in the // object that represents that component Object data = getValue(ctx, comps[0], line, missingIsNull); for (int ii = 1; ii < comps.length; ii++) { if (data == NO_FETCHER_FOUND) { if (!missingIsNull) throw new MustacheException.Context( "Missing context for compound variable '" + name + "' on line " + line + ". '" + comps[ii - 1] + "' was not found.", name, line); return null; } else if (data == null) { return null; } // once we step into a composite key, we drop the ability to query our parent contexts; // that would be weird and confusing data = getValueIn(data, comps[ii], line); } return checkForMissing(name, line, missingIsNull, data); }
Object value = getValueIn(ctx.data, name, line); return checkForMissing(name, line, missingIsNull, value); Object value = getValueIn(pctx.data, name, line); if (value != NO_FETCHER_FOUND) return value;
/** * Decomposes the compound key {@code name} into components and resolves the value they * reference. */ protected Object getCompoundValue (Context ctx, String name, int line, boolean missingIsNull) { String[] comps = name.split("\\."); // we want to allow the first component of a compound key to be located in a parent // context, but once we're selecting sub-components, they must only be resolved in the // object that represents that component Object data = getValue(ctx, comps[0].intern(), line, missingIsNull); for (int ii = 1; ii < comps.length; ii++) { if (data == NO_FETCHER_FOUND) { if (!missingIsNull) throw new MustacheException.Context( "Missing context for compound variable '" + name + "' on line " + line + ". '" + comps[ii - 1] + "' was not found.", name, line); return null; } else if (data == null) { return null; } // once we step into a composite key, we drop the ability to query our parent contexts; // that would be weird and confusing data = getValueIn(data, comps[ii].intern(), line); } return checkForMissing(name, line, missingIsNull, data); }