samedi 30 mai 2015

I need write function which returns object of class, which formed from an array of strings property - value.

 public interface Facroty {
    public Object getObject(String className, String[] pairs);
 }
 Facroty imp = getFactory();
 Object adminJohn = imp.getObjst("User" "userGroup", "admin", "userName", "John");

It shoud be translete to:

public static Class User {
    public String userGroup;
    public String userName;
}
User adminJohn = new User();
adminJohn.userGroup = "admin";
adminJohn.userName = "John";

The question is: how to write getFactory() ?





Aucun commentaire:

Enregistrer un commentaire