What is the most appropriate way to save a Map from Class to an Handler object in Java? -


I have an incoming row of requests and want to be able to register different types of handler objects (interface request handles) What is the most appropriate (most efficient and fast) way to store this map (Identify by their class)?

To clear: I find the best way to store the relationship between class and handler.

I used the map & lt; Class, request handler & gt; Use and make sure to match it with individual types of methods.

  Private Last Maps & lt; Class, request handler & gt; Handlrank = new Hashmop & lt; & Gt; (); Public & lt; T requests increase & gt; Zero sethandler (class  tClass, request handler & lt; T & gt; handler) {handler map. Input (T-class, handler); } Public & lt; T requests increase & gt; RequestHandler & LT; T & gt; GetHandler (class  gt; tClass) {return (request handler & lt; T & gt;) handler Map.get (tClass); }    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -