tables.sbn 1009 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. {{~if __namespace != ''~}}
  2. package {{__namespace}};
  3. {{~end~}}
  4. import luban.*;
  5. import com.google.gson.JsonElement;
  6. {{~
  7. func get_table_inner_name
  8. ret '_' + ($0 | string.downcase)
  9. end
  10. ~}}
  11. public final class {{__name}}
  12. {
  13. public interface IJsonLoader {
  14. JsonElement load(String file) throws java.io.IOException;
  15. }
  16. {{~for table in __tables
  17. inner_name = get_table_inner_name table.name
  18. ~}}
  19. {{~if table.comment != '' ~}}
  20. /**
  21. * {{escape_comment table.comment}}
  22. */
  23. {{~end~}}
  24. private final {{table.full_name_with_top_module}} {{inner_name}};
  25. public {{table.full_name_with_top_module}} get{{table.name}}() { return {{inner_name}}; }
  26. {{~end~}}
  27. public {{__name}}(IJsonLoader loader) throws java.io.IOException {
  28. {{~for table in __tables
  29. inner_name = get_table_inner_name table.name
  30. ~}}
  31. {{inner_name}} = new {{table.full_name_with_top_module}}(loader.load("{{table.output_data_file}}"));
  32. {{~end~}}
  33. }
  34. }