code: public static VehicleInterface build(
              Class<? extends VehicleInterface> interfaceType,
              Context context, String resource) throws VehicleInterfaceException {
          Log.d(TAG, "Constructing new instance of " + interfaceType
                  + " with resource " + resource);
          Constructor<? extends VehicleInterface> constructor;
          try {
              constructor = interfaceType.getConstructor(
                      Context.class, String.class);
          } catch(NoSuchMethodException e) {
              throw new VehicleInterfaceException(interfaceType +
                      " doesn't have a proper constructor", e);
          }
  
          String message;
          Exception error;
          try {
              return constructor.newInstance(context, resource);
          } catch(InstantiationException e) {
              message = "Couldn't instantiate vehicle interface " +
                  interfaceType;
              error = e;
          } catch(IllegalAccessException e) {
              message = "Default constructor is not accessible on " +
                  interfaceType;
              error = e;
          } catch(InvocationTargetException e) {
              message = interfaceType + "'s constructor threw an exception";
              error = e;
          }
          throw new VehicleInterfaceException(message, error);
      }
docs: Retrieve the Class for a given name and construct an instance of it.
  
  @param interfaceType the desired class to load and instantiate.
  @param context The Android application or service context to be passed to
  the new instance of the VehicleInterface.
  @param resource A reference to a resource the new instance should use -
  see the specific implementation of {@link VehicleInterface} for its
  requirements.
  @return A new instance of the class given in interfaceType.
  @throws VehicleInterfaceException If the class' constructor threw an
  exception.