public class

VehicleInterfaceFactory

extends Object
java.lang.Object
   ↳ com.openxc.interfaces.VehicleInterfaceFactory

Class Overview

A factory that uses reflection to create instance of VehicleInterface implementations.

Summary

Public Constructors
VehicleInterfaceFactory()
Public Methods
static VehicleInterface build(Class<? extends VehicleInterface> interfaceType, Context context, String resource)
Retrieve the Class for a given name and construct an instance of it.
static VehicleInterface build(String interfaceName, Context context, String resource)
Retrieve the Class for a given name and construct an instance of it.
static Class<? extends VehicleInterface> findClass(String interfaceName)
Obtain the Class object for a given VehicleInterface class name.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public VehicleInterfaceFactory ()

Public Methods

public static VehicleInterface build (Class<? extends VehicleInterface> interfaceType, Context context, String resource)

Retrieve the Class for a given name and construct an instance of it.

Parameters
interfaceType the desired class to load and instantiate.
context The Android application or service context to be passed to the new instance of the VehicleInterface.
resource A reference to a resource the new instance should use - see the specific implementation of VehicleInterface for its requirements.
Returns
  • A new instance of the class given in interfaceType.
Throws
VehicleInterfaceException If the class' constructor threw an exception.

public static VehicleInterface build (String interfaceName, Context context, String resource)

Retrieve the Class for a given name and construct an instance of it.

Throws
VehicleInterfaceException If the named interfaced could not be found or if its constructor threw an exception.

public static Class<? extends VehicleInterface> findClass (String interfaceName)

Obtain the Class object for a given VehicleInterface class name. The class must be in the classpath of the process' context, or an exception will be thrown.

Parameters
interfaceName the canonical name of class implementing VehicleInterface
Returns
  • the Class object, if found.
Throws
VehicleInterfaceException if the named class could not be found or loaded.