public static object convertToHaxe(global::maglev.MagLevAny x)
        {
                        #line 16 "/my-component/src/persistence/MagLevConverter.hx"
            if ((x.getType() == global::maglev.MagLevNull.getStaticType()))
            {
                                #line 17 "/my-component/src/persistence/MagLevConverter.hx"
                return(null);
            }
            else if ((x.getType() == global::maglev.MagLevBoolean.getStaticType()))
            {
                                #line 20 "/my-component/src/persistence/MagLevConverter.hx"
                global::maglev.MagLevBoolean y = ((global::maglev.MagLevBoolean)(x));
                return((object)(y.getBool()));
            }
            else if ((x.getType() == global::maglev.MagLevString.getStaticType()))
            {
                                #line 24 "/my-component/src/persistence/MagLevConverter.hx"
                global::maglev.MagLevString y1 = ((global::maglev.MagLevString)(x));
                return((object)(y1.getString()));
            }
            else if ((x.getType() == global::maglev.MagLevNumber.getStaticType()))
            {
                                #line 28 "/my-component/src/persistence/MagLevConverter.hx"
                global::maglev.MagLevNumber y2 = ((global::maglev.MagLevNumber)(x));
                return((object)(y2.getFloat()));
            }
            else if ((x.getType() == global::maglev.MagLevArray.getStaticType()))
            {
                                #line 32 "/my-component/src/persistence/MagLevConverter.hx"
                global::maglev.MagLevArray y3  = ((global::maglev.MagLevArray)(x));
                global::Array <object>     arr = new global::Array <object>();
                                #line 34 "/my-component/src/persistence/MagLevConverter.hx"
                int i = 0;
                while ((i < y3.size()))
                {
                                        #line 36 "/my-component/src/persistence/MagLevConverter.hx"
                    arr.push(global::persistence.MagLevConverter.convertToHaxe(y3.@get(i)));
                    ++i;
                }

                                #line 39 "/my-component/src/persistence/MagLevConverter.hx"
                return((object)(arr));
            }
            else if ((x.getType() == global::maglev.MagLevObject.getStaticType()))
            {
                                #line 42 "/my-component/src/persistence/MagLevConverter.hx"
                global::maglev.MagLevObject        y4  = ((global::maglev.MagLevObject)(x));
                global::haxe.ds.StringMap <object> map = new global::haxe.ds.StringMap <object>();
                                #line 44 "/my-component/src/persistence/MagLevConverter.hx"
                global::maglev.MagLevArray keys = y4.keys();
                int i1 = 0;
                                #line 46 "/my-component/src/persistence/MagLevConverter.hx"
                while ((i1 < keys.size()))
                {
                                        #line 47 "/my-component/src/persistence/MagLevConverter.hx"
                    string key = (((global::maglev.MagLevString)(keys.@get(i1)))).getString();
                    map.@set(key, global::persistence.MagLevConverter.convertToHaxe(y4.@get(key)));
                                        #line 49 "/my-component/src/persistence/MagLevConverter.hx"
                    ++i1;
                }

                                #line 51 "/my-component/src/persistence/MagLevConverter.hx"
                return((object)(map));
            }
            else if ((x.getType() == global::maglev.MagLevFunction.getStaticType()))
            {
                                #line 54 "/my-component/src/persistence/MagLevConverter.hx"
                global::maglev.MagLevFunction y5 = ((global::maglev.MagLevFunction)(x));
                global::haxe.lang.Function    f  = new global::persistence.MagLevConverter_convertToHaxe_55__Fun(y5);
                                #line 69 "/my-component/src/persistence/MagLevConverter.hx"
                return((object)(f));
            }
            else
            {
                                #line 72 "/my-component/src/persistence/MagLevConverter.hx"
                throw ((global::System.Exception)(global::haxe.Exception.thrown("convertToHaxe: unknown type")));
            }
        }
        public virtual object convertToHaxe(global::maglev.MagLevAny x)
        {
                        #line 107 "/my-component/src/maglev/MagLevCs.hx"
            if ((x.getType() == global::maglev.MagLevNull.getStaticType()))
            {
                                #line 108 "/my-component/src/maglev/MagLevCs.hx"
                return(null);
            }
            else if ((x.getType() == global::maglev.MagLevBoolean.getStaticType()))
            {
                                #line 111 "/my-component/src/maglev/MagLevCs.hx"
                global::maglev.MagLevBoolean y = ((global::maglev.MagLevBoolean)(x));
                return((object)(y.getBool()));
            }
            else if ((x.getType() == global::maglev.MagLevString.getStaticType()))
            {
                                #line 115 "/my-component/src/maglev/MagLevCs.hx"
                global::maglev.MagLevString y1 = ((global::maglev.MagLevString)(x));
                return((object)(y1.getString()));
            }
            else if ((x.getType() == global::maglev.MagLevNumber.getStaticType()))
            {
                                #line 119 "/my-component/src/maglev/MagLevCs.hx"
                global::maglev.MagLevNumber y2 = ((global::maglev.MagLevNumber)(x));
                return((object)(y2.getFloat()));
            }
            else if ((x.getType() == global::maglev.MagLevArray.getStaticType()))
            {
                                #line 123 "/my-component/src/maglev/MagLevCs.hx"
                global::maglev.MagLevArray y3  = ((global::maglev.MagLevArray)(x));
                global::Array <object>     arr = new global::Array <object>();
                                #line 125 "/my-component/src/maglev/MagLevCs.hx"
                int i = 0;
                while ((i < y3.size()))
                {
                                        #line 127 "/my-component/src/maglev/MagLevCs.hx"
                    arr.push(this.convertToHaxe(y3.@get(i)));
                    ++i;
                }

                                #line 130 "/my-component/src/maglev/MagLevCs.hx"
                return((object)(arr));
            }
            else if ((x.getType() == global::maglev.MagLevObject.getStaticType()))
            {
                                #line 133 "/my-component/src/maglev/MagLevCs.hx"
                global::maglev.MagLevObject        y4  = ((global::maglev.MagLevObject)(x));
                global::haxe.ds.StringMap <object> map = new global::haxe.ds.StringMap <object>();
                                #line 135 "/my-component/src/maglev/MagLevCs.hx"
                global::maglev.MagLevArray keys = y4.keys();
                int i1 = 0;
                                #line 137 "/my-component/src/maglev/MagLevCs.hx"
                while ((i1 < keys.size()))
                {
                                        #line 138 "/my-component/src/maglev/MagLevCs.hx"
                    string key = (((global::maglev.MagLevString)(keys.@get(i1)))).getString();
                    map.@set(key, this.convertToHaxe(y4.@get(key)));
                                        #line 140 "/my-component/src/maglev/MagLevCs.hx"
                    ++i1;
                }

                                #line 142 "/my-component/src/maglev/MagLevCs.hx"
                return((object)(map));
            }
            else
            {
                                #line 145 "/my-component/src/maglev/MagLevCs.hx"
                throw ((global::System.Exception)(global::haxe.Exception.thrown("convertToHaxe: unknown type")));
            }
        }