| 8800 | } |
| 8801 | |
| 8802 | std::string GeneratorKotlin::ConvertDefault(const std::string& domain, const std::string& package, const std::string& type) |
| 8803 | { |
| 8804 | if (type == "bool") |
| 8805 | return "false"; |
| 8806 | else if (type == "byte") |
| 8807 | return "0.toByte()"; |
| 8808 | else if (type == "bytes") |
| 8809 | return "ByteArray(0)"; |
| 8810 | else if ((type == "char") || (type == "wchar")) |
| 8811 | return "'\\u0000'"; |
| 8812 | else if (type == "int8") |
| 8813 | return "0.toByte()"; |
| 8814 | else if (type == "uint8") |
| 8815 | return "0.toUByte()"; |
| 8816 | else if (type == "int16") |
| 8817 | return "0.toShort()"; |
| 8818 | else if (type == "uint16") |
| 8819 | return "0.toUShort()"; |
| 8820 | else if (type == "int32") |
| 8821 | return "0"; |
| 8822 | else if (type == "uint32") |
| 8823 | return "0u"; |
| 8824 | else if (type == "int64") |
| 8825 | return "0L"; |
| 8826 | else if (type == "uint64") |
| 8827 | return "0uL"; |
| 8828 | else if (type == "float") |
| 8829 | return "0.0f"; |
| 8830 | else if (type == "double") |
| 8831 | return "0.0"; |
| 8832 | else if (type == "decimal") |
| 8833 | return "java.math.BigDecimal.valueOf(0L)"; |
| 8834 | else if (type == "string") |
| 8835 | return "\"\""; |
| 8836 | else if (type == "timestamp") |
| 8837 | return ((Version() < 8) ? "java.util.Date(0)" : "java.time.Instant.EPOCH"); |
| 8838 | else if (type == "uuid") |
| 8839 | return domain + "fbe.UUIDGenerator.nil()"; |
| 8840 | |
| 8841 | std::string ns = ""; |
| 8842 | std::string t = type; |
| 8843 | |
| 8844 | size_t pos = type.find_last_of('.'); |
| 8845 | if (pos != std::string::npos) |
| 8846 | { |
| 8847 | ns.assign(type, 0, pos + 1); |
| 8848 | ns = domain + ns; |
| 8849 | t.assign(type, pos + 1, type.size() - pos); |
| 8850 | } |
| 8851 | else if (!package.empty()) |
| 8852 | ns = domain + package + "."; |
| 8853 | |
| 8854 | return ns + t + "()"; |
| 8855 | } |
| 8856 | |
| 8857 | std::string GeneratorKotlin::ConvertDefault(const std::string& domain, const std::string& package, const StructField& field) |
| 8858 | { |