IndieGame/config/Table/Tools/Luban/Templates/java-json/tables.sbn
DOBEST\zhaoyingjie f242607587 初始化工程
2024-10-11 10:12:15 +08:00

40 lines
1009 B
Plaintext

{{~if __namespace != ''~}}
package {{__namespace}};
{{~end~}}
import luban.*;
import com.google.gson.JsonElement;
{{~
func get_table_inner_name
ret '_' + ($0 | string.downcase)
end
~}}
public final class {{__name}}
{
public interface IJsonLoader {
JsonElement load(String file) throws java.io.IOException;
}
{{~for table in __tables
inner_name = get_table_inner_name table.name
~}}
{{~if table.comment != '' ~}}
/**
* {{escape_comment table.comment}}
*/
{{~end~}}
private final {{table.full_name_with_top_module}} {{inner_name}};
public {{table.full_name_with_top_module}} get{{table.name}}() { return {{inner_name}}; }
{{~end~}}
public {{__name}}(IJsonLoader loader) throws java.io.IOException {
{{~for table in __tables
inner_name = get_table_inner_name table.name
~}}
{{inner_name}} = new {{table.full_name_with_top_module}}(loader.load("{{table.output_data_file}}"));
{{~end~}}
}
}