firstElement().elements())
{
h.set(n.get(???id???),
{
country : n.get(???country???),
languages : n.get(???lang???).split(???,???),
currency : n.get(???currencty???)
});
}
var p = new LocaleProxy(h.get);
return p;
}
}
typedef Locale = {
country : String,
languages : Array < String > ,
currency: String
}
This is the third type of proxy class that is described in the book. The first and the second, the haxe
.remoting.Proxy and haxe.remoting.AsyncProxy from the Remoting API, are discussed in Chapter 15 .
Reflection API
Reflection in computer science is the capability of changing or inspecting the type definitions at run time
(during the execution of the program). Just to cite some uses for reflection, it is possible to set a value for
an object field just knowing its name at run time, or to create an instance without using the new keyword
and also without invoking its constructor.
In the reflection area haXe provides some useful classes; the two most important ones are Reflect
and Type .
The Reflect Class
The Reflect class from the standard library is very handy to handle object instances at a very low level
and it contains the static methods detailed in the Table 16 - 1 .
Pages:
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863