class CallbackInstantiator {

  public static <T> T getObjectOfType(String classOrMethod, Class<T> expectedClazz) {
    T object;
    try {
      object = getObjectOfTypeFromClassName(classOrMethod, expectedClazz);
    } catch (Exception ignore) {
      object = getObjectOfTypeFromFactoryMethod(classOrMethod);
    }
    return object;
  }

}