FileDocCategorySizeDatePackage
PresenterFactory.javaAPI DocAndroid 1.5 API2208Wed May 06 22:42:46 BST 2009com.android.mms.ui

PresenterFactory

public class PresenterFactory extends Object
The factory of concrete presenters.

Fields Summary
private static final String
TAG
private static final String
PRESENTER_PACKAGE
Constructors Summary
Methods Summary
public static PresentergetPresenter(java.lang.String className, android.content.Context context, ViewInterface view, com.android.mms.model.Model model)


          
                
        try {
            if (className.indexOf(".") == -1) {
                className = PRESENTER_PACKAGE + className;
            }

            Class c = Class.forName(className);
            Constructor constructor = c.getConstructor(
                    Context.class, ViewInterface.class, Model.class);
            return (Presenter) constructor.newInstance(context, view, model);
        } catch (ClassNotFoundException e) {
            Log.e(TAG, "Type not found: " + className, e);
        } catch (NoSuchMethodException e) {
            // Impossible to reach here.
            Log.e(TAG, "No such constructor.", e);
        } catch (InvocationTargetException e) {
            Log.e(TAG, "Unexpected InvocationTargetException", e);
        } catch (IllegalAccessException e) {
            Log.e(TAG, "Unexpected IllegalAccessException", e);
        } catch (InstantiationException e) {
            Log.e(TAG, "Unexpected InstantiationException", e);
        }

        return null;