public Router(RestConfig[] restConfigs, Config[] customHandlerConfigs, RestModel model) { // for every configuration create a route with an associated handler foreach (RestConfig restConfig in restConfigs) { // create the rest handler Handler handler = new RestHandler(restConfig.verbs, restConfig.prefab, model); this.Routes.Add(restConfig.name, handler); } // for the other configurations these use custom handlers foreach (Config config in customHandlerConfigs) { // we need to get the type of the handler from the string provided Type T = Type.GetType(config.handler); // Check that the type is a subclass of handler, otherwise the conversion would fail if (T.IsSubclassOf(typeof(Handler))) { ConstructorInfo constructor = T.GetConstructors()[0]; // create arguments object[] array = {}; // There are no arguments so we generate a new Handler this.Routes.Add(config.name, constructor.Invoke(array) as Handler); } } }
public MessageHandler(RestModel rest) { Rest = rest; }
public RestHandler(string[] verbs, string prefabFileName, RestModel model) : base() { this.Model = model; this.Verbs = verbs; this.PrefabFileName = prefabFileName; }
public ConfigConverter(RestModel model) { this.Model = model; }