public SoyValue applyForJava()

in java/com/google/cloud/deploymentmanager/autogen/soy/SoyDirectives.java [145:168]


    public SoyValue applyForJava(SoyValue value, List<SoyValue> args) {
      final String spacer = " ".repeat(args.get(0).integerValue());
      Iterable<String> pre;
      Iterable<String> toBeIndented;
      if (getIndentFirstArg(args)) {
        pre = ImmutableList.of();
        toBeIndented = SPLITTER.split(value.coerceToString());
      } else {
        List<String> lines = SPLITTER.splitToList(value.coerceToString());
        pre = Iterables.limit(lines, 1);
        toBeIndented = Iterables.skip(lines, 1);
      }
      Iterable<String> indented = Iterables.transform(toBeIndented, new Function<String, String>() {
        @Override
        public String apply(String s) {
          if (s.trim().isEmpty()) {
            // Don't indent lines with only spaces.
            return s;
          }
          return spacer + s;
        }
      });
      return StringData.forValue(JOINER.join(Iterables.concat(pre, indented)));
    }