我在將值設置爲SoyFileSupplier列表時遇到問題,列表中應該有類型文件的值,通過傳遞一個soyFileSupplier列表來將soyfilesetParse類用於解析,將值設置爲。文件(sample.soy)將值設置爲列表
The sample code is as below:
public class test {
main() {
soyTree=parseSoyFiles(soyFileSuppliers);
}
}
調用類是:
public class soyFileSetParse {
public static SoyFileSetNode parseSoyFiles(List<SoyFileSupplier> soyFileSuppliers)
throws SoySyntaxException {
IdGenerator nodeIdGen = new IntegerIdGenerator();
SoyFileSetNode soyTree = new SoyFileSetNode(nodeIdGen.genStringId(), nodeIdGen);
for (SoyFileSupplier soyFileSupplier : soyFileSuppliers) {
soyTree.addChild(parseSoyFileHelper(soyFileSupplier, nodeIdGen));
}
return soyTree;
}
}
設置爲文件類型:
public class SoyFileSupplier {
/**
* Creates a new {@code SoyFileSupplier} given a {@code File}.
*
* @param inputFile The Soy file.
*/
public SoyFileSupplier(File inputFile) {
this(Files.newReaderSupplier(inputFile, Charsets.UTF_8), inputFile.getPath());
}
我不明白我做錯了什麼。
您的問題是什麼? – Saket