package de.thedevstack.conversationsplus.ui.forms; import android.content.Context; import java.util.Hashtable; import de.thedevstack.conversationsplus.xmpp.forms.Field; public class FormFieldFactory { private static final Hashtable typeTable = new Hashtable<>(); static { typeTable.put("text-single", FormTextFieldWrapper.class); typeTable.put("text-multi", FormTextFieldWrapper.class); typeTable.put("text-private", FormTextFieldWrapper.class); typeTable.put("jid-single", FormJidSingleFieldWrapper.class); typeTable.put("boolean", FormBooleanFieldWrapper.class); } protected static FormFieldWrapper createFromField(Context context, Field field) { Class clazz = typeTable.get(field.getType()); if (clazz == null) { clazz = FormTextFieldWrapper.class; } return FormFieldWrapper.createFromField(clazz, context, field); } }