@Override Object protoFromSoy(SoyValue field) { SoyList list = (SoyList) field; List<Object> uninterpretedValues = new ArrayList<>(); for (SoyValue item : list.asResolvedJavaList()) { uninterpretedValues.add(local.protoFromSoy(item)); } return uninterpretedValues; } };
/** Checks if list contains a value. */ public static boolean listContains(SoyList list, SoyValue value) { return list.asJavaList().contains(value); }
@Override public SoyValue computeForJava(List<SoyValue> args) { SoyValue arg = args.get(0); if (arg == null) { throw new IllegalArgumentException("Argument to length() function is null."); } if (!(arg instanceof SoyList)) { throw new IllegalArgumentException( "Argument to length() function is not a SoyList " + "(found type " + arg.getClass().getName() + ")."); } return IntegerData.forValue(((SoyList) arg).length()); }
int listLength = foreachList.length(); if (listLength > 0) { executeForeachBody(child, i, foreachList.getProvider(i), listLength);
int listLength = foreachList.length(); if (listLength > 0) { executeForeachBody(child, i, foreachList.getProvider(i), listLength);
@Override Object protoFromSoy(SoyValue field) { SoyList list = (SoyList) field; List<Object> uninterpretedValues = new ArrayList<>(); for (SoyValue item : list.asResolvedJavaList()) { uninterpretedValues.add(local.protoFromSoy(item)); } return uninterpretedValues; } };
/** Concatenates its arguments. */ public static List<SoyValueProvider> concatLists(List<SoyList> args) { ImmutableList.Builder<SoyValueProvider> flattened = ImmutableList.builder(); for (SoyList soyList : args) { flattened.addAll(soyList.asJavaList()); } return flattened.build(); }
return new ArrayList<>(Lists.transform(((SoyList) data).asResolvedJavaList(), new Function<SoyValue, Object>() { @Override public Object apply(SoyValue from) {
/** * IMPORTANT: Do not use this method. Consider it internal to Soy. * * <p>Creates a new SoyEasyList initialized from a SoyList. * * @param list The list of initial values. * @return A new SoyEasyList initialized from the given SoyList. */ @Deprecated public SoyEasyList newEasyListFromList(SoyList list) { EasyListImpl result = new EasyListImpl(); for (SoyValueProvider provider : list.asJavaList()) { result.add(provider); } return result; }
/** * IMPORTANT: Do not use this method. Consider it internal to Soy. * * <p>Creates a new SoyEasyList initialized from a SoyList. * * @param list The list of initial values. * @return A new SoyEasyList initialized from the given SoyList. */ @Deprecated public SoyEasyList newEasyListFromList(SoyList list) { EasyListImpl result = new EasyListImpl(); for (SoyValueProvider provider : list.asJavaList()) { result.add(provider); } return result; }
params[i] = value.stringValue(); } else if (type == List.class) { params[i] = ((SoyList) value).asJavaList(); } else if (Message.class.isAssignableFrom(type)) { params[i] = type.cast(((SoyProtoValue) value).getProto());