/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ namespace java.swift test.fixtures.complex_struct typedef string stringTypedef typedef i64 longTypeDef typedef map mapTypedef typedef list listTypedef typedef float floatTypedef typedef map ( java.swift.type = "it.unimi.dsi.fastutil.ints.Int2LongArrayMap", ) FMap enum MyEnum { MyValue1 = 0, MyValue2 = 1, MyValue3 = 3, MyValue4 = 4, MyValue5 = 5, } struct MyStructFloatFieldThrowExp { 1: i64 myLongField; 2: byte MyByteField; 3: string myStringField; 4: float myFloatField; } struct MyStructMapFloatThrowExp { 1: i64 myLongField; 2: map>> mapListOfFloats; } struct MyStruct { 1: i64 MyIntField; 2: string MyStringField; 3: MyDataItem MyDataField; 4: MyEnum myEnum; 5: bool MyBoolField; 6: byte MyByteField; 7: i16 MyShortField; 8: i64 MyLongField; 9: double MyDoubleField; 10: list lDouble; 11: list lShort; 12: list lInteger; 13: list lLong; 14: list lString; 15: list lBool; 16: list lByte; 17: map mShortString; 18: map mIntegerString; 19: map mStringMyStruct; 20: map mStringBool; 21: map mIntegerInteger; 22: map mIntegerBool; 23: set sShort; 24: set sMyStruct; 25: set sLong; 26: set sString; 27: set sByte; 28: map, list> mListList; } struct SimpleStruct { 1: i64 age = 60; 2: string name = "Batman"; } const i32 DEFAULT_PORT_NUM = 3456; const MyUnion constEnumUnion = {"myEnum": MyEnum.MyValue2}; struct defaultStruct { 1: i64 myLongDFset = 10; // default value is 10 2: i64 myLongDF; // default value is 0 3: i32 portDFset = DEFAULT_PORT_NUM; 4: i32 portNum; 5: binary myBinaryDFset = "abc"; 6: binary myBinary; 7: byte myByteDFSet = 17; 8: byte myByte; 9: double myDoubleDFset = 99.7678; 10: double myDoubleDFZero = 0.0; 12: double myDouble; 13: map field3 = {15: 'a_value', 2: 'b_value'}; 14: list myList = [MyEnum.MyValue1, MyEnum.MyValue1, MyEnum.MyValue2]; 15: set mySet = ["house", "car", "dog"]; 16: SimpleStruct simpleStruct = {"age": 40, "name": "John"}; 17: list listStructDFset = [ {"age": 40, "name": "IronMan"}, {"age": 999, "name": "Thanos"}, ]; 18: MyUnion myUnion = constEnumUnion; 19: list listUnionDFset = [ {"myEnum": MyEnum.MyValue2}, {"intValue": 123}, ]; 20: map> mapNestlistStructDfSet = { 1: [{"age": 40, "name": "IronMan"}, {"age": 999, "name": "Thanos"}], 2: [{"age": 28, "name": "BatMan"}, {"age": 12, "name": "Robin"}], 5: [{"age": 12, "name": "RatMan"}, {"age": 6, "name": "Catman"}], }; 21: map_i64_string_5732 mapJavaTypeDFset = {15: 'a_value', 2: 'b_value'}; 22: map emptyMap = {}; 23: map> enumMapDFset = { "SANDY BRIDGE": {16: MyEnum.MyValue1, 144: MyEnum.MyValue1}, "IVY BRIDGE": {32: MyEnum.MyValue2, 144: MyEnum.MyValue2}, "HASWELL": {32: MyEnum.MyValue3,128: MyEnum.MyValue3,256: MyEnum.MyValue3,}, }; } struct MyStructTypeDef { 1: i64 myLongField; 2: longTypeDef myLongTypeDef; 3: string myStringField; 4: stringTypedef myStringTypedef; 5: map myMapField; 6: mapTypedef myMapTypedef; 7: list myListField; 8: listTypedef myListTypedef; 9: map> myMapListOfTypeDef; } struct MyDataItem {} union MyUnion { 1: MyEnum myEnum; 2: MyStruct myStruct; 3: MyDataItem myDataItem; 4: ComplexNestedStruct complexNestedStruct; 5: i64 longValue; 6: i32 intValue; } union MyUnionFloatFieldThrowExp { 1: MyEnum myEnum; 2: list> setFloat; 3: MyDataItem myDataItem; 4: ComplexNestedStruct complexNestedStruct; } struct ComplexNestedStruct { // collections of collections 1: set> setOfSetOfInt; 2: list>>> listofListOfListOfListOfEnum; 3: list> listOfListOfMyStruct; 4: set>> setOfListOfListOfLong; 5: set>> setOfSetOfsetOfLong; 6: map>> mapStructListOfListOfLong; 7: map mKeyStructValInt; 8: list> listOfMapKeyIntValInt; 9: list>> listOfMapKeyStrValList; // Maps with collections as keys 10: map, i64> mapKeySetValLong; 11: map, i32> mapKeyListValLong; // Map with collections as keys and values 12: map, map> mapKeyMapValMap; 13: map>, map>, string>> mapKeySetValMap; 14: map, string>, map> NestedMaps; 15: map> mapKeyIntValList; 16: map> mapKeyIntValSet; 17: map, MyEnum> mapKeySetValInt; 18: map, set>> mapKeyListValSet; } struct TypeRemapped { 1: map_i64_string_5732 lsMap; 2: map_i32_FMap_6797 ioMap; 3: i32_1194 BigInteger; 4: binary_4918 binaryTestBuffer; } exception emptyXcep {} exception reqXcep { 1: required string message; 2: required i32 errorCode; } exception optXcep { 1: optional string message; 2: optional i32 errorCode; } exception complexException { 1: string message; 2: list listStrings; 3: MyEnum errorEnum; 4: optional MyUnion unionError; 5: MyStruct structError; 6: map_i64_string_5732 lsMap; } // The following were automatically generated and may benefit from renaming. typedef binary (java.swift.type = "java.nio.ByteBuffer") binary_4918 typedef i32 (java.swift.type = "java.math.BigInteger") i32_1194 typedef map ( java.swift.type = "it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap", ) map_i32_FMap_6797 typedef map ( java.swift.type = "it.unimi.dsi.fastutil.longs.Long2ObjectArrayMap", ) map_i64_string_5732