@Override @Nonnull public Map<String, ? extends SoyValue> asResolvedJavaStringMap() { return asMap(); }
@Override @Nonnull public Map<String, ? extends SoyValueProvider> asJavaStringMap() { return asMap(); }
@Override @Nonnull public Map<String, ? extends SoyValueProvider> asJavaStringMap() { return asMap(); }
@Override @Nonnull public Map<String, ? extends SoyValue> asResolvedJavaStringMap() { return asMap(); }
private void addCompileTimeGlobalModel(final SoyFileSet.Builder sfsBuilder) { final Optional<SoyMapData> soyMapData = compileTimeGlobalModelResolver.resolveData(); if (soyMapData.isPresent()) { final Map<String, ?> mapData = soyMapData.get().asMap(); if (mapData.size() > 0) { logger.debug("Setting compile time globals, entries number:" + mapData.size()); sfsBuilder.setCompileTimeGlobals(mapData); } } }
public static SoyMapData $$augmentData(SoyMapData baseData, SoyMapData additionalData) { AugmentedSoyMapData augmentedData = new AugmentedSoyMapData(baseData); for (Map.Entry<String, SoyData> entry : additionalData.asMap().entrySet()) { augmentedData.putSingle(entry.getKey(), entry.getValue()); } return augmentedData; }
/** * Private helper for {@code asMap()} to add a map (or submap) to the combined map data. * @param combinedMapData The combined map data that we're building. * @param keyPrefix The key prefix if adding a submap (or empty string if adding one of the * top-level maps: the base data or the augmented data). * @param map The map of data to add. */ private static void addMapDataHelper( SoyMapData combinedMapData, String keyPrefix, Map<String, SoyData> map) { for (Map.Entry<String, SoyData> entry : map.entrySet()) { String key = entry.getKey(); SoyData value = entry.getValue(); if (value instanceof SoyMapData) { addMapDataHelper(combinedMapData, keyPrefix + key + ".", ((SoyMapData) value).asMap()); } else if (value instanceof SoyListData) { addListDataHelper(combinedMapData, keyPrefix + key + ".", ((SoyListData) value).asList()); } else { combinedMapData.put(keyPrefix + key, value); } } }
/** * Private helper for {@code asMap()} to add a sublist to the combined map data. * @param combinedMapData The combined map data that we're building. * @param keyPrefix The key prefix for this sublist. * @param list The list of data to add. */ private static void addListDataHelper( SoyMapData combinedMapData, String keyPrefix, List<SoyData> list) { for (int i = 0; i < list.size(); ++i) { SoyData el = list.get(i); if (el instanceof SoyMapData) { addMapDataHelper(combinedMapData, keyPrefix + i + ".", ((SoyMapData) el).asMap()); } else if (el instanceof SoyListData) { addListDataHelper(combinedMapData, keyPrefix + i + ".", ((SoyListData) el).asList()); } else { combinedMapData.put(keyPrefix + i, el); } } }
return Maps.transformValues(((SoyMapData) data).asMap(), new Function<SoyData, Object>()