public class DefaultDriver extends Object implements Driver
| Constructor and Description |
|---|
DefaultDriver(String name,
List<Driver> parents,
String manufacturer,
String hwVersion,
String swVersion,
Map<Class<? extends Behaviour>,Class<? extends Behaviour>> behaviours,
Map<String,String> properties)
Creates a driver with the specified name.
|
| Modifier and Type | Method and Description |
|---|---|
Set<Class<? extends Behaviour>> |
behaviours()
Returns the set of behaviours supported by this driver.
|
<T extends Behaviour> |
createBehaviour(DriverData data,
Class<T> behaviourClass)
Creates an instance of behaviour primed with the specified driver data.
|
<T extends Behaviour> |
createBehaviour(DriverHandler handler,
Class<T> behaviourClass)
Creates an instance of behaviour primed with the specified driver handler.
|
boolean |
equals(Object driverToBeCompared) |
String |
getProperty(String name)
Gets the value of given property name.
|
boolean |
hasBehaviour(Class<? extends Behaviour> behaviourClass)
Indicates whether or not the driver, or any of its parents, support
the specified class of behaviour.
|
int |
hashCode() |
String |
hwVersion()
Returns the device hardware version.
|
Class<? extends Behaviour> |
implementation(Class<? extends Behaviour> behaviour)
Returns the implementation class for the specified behaviour.
|
Set<String> |
keys()
Returns the set of keys for available annotations.
|
String |
manufacturer()
Returns the device manufacturer name.
|
Driver |
merge(Driver other)
Merges the specified driver behaviours and properties into this one,
giving preference to the other driver when dealing with conflicts.
|
String |
name()
Returns the driver name.
|
Driver |
parent()
Returns the parent driver from which this driver inherits behaviours
and properties.
|
List<Driver> |
parents()
Returns all the parent drivers from which this driver inherits behaviours
and properties.
|
Map<String,String> |
properties()
Returns the set of annotations as map of key/value properties.
|
String |
swVersion()
Returns the device software version.
|
String |
toString() |
String |
value(String key)
Returns the value of the specified annotation.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetPropertypublic DefaultDriver(String name, List<Driver> parents, String manufacturer, String hwVersion, String swVersion, Map<Class<? extends Behaviour>,Class<? extends Behaviour>> behaviours, Map<String,String> properties)
name - driver nameparents - optional parent driversmanufacturer - device manufacturerhwVersion - device hardware versionswVersion - device software versionbehaviours - device behaviour classesproperties - properties for configuration of device behaviour classespublic Driver merge(Driver other)
Driverpublic String name()
Driverpublic String manufacturer()
Drivermanufacturer in interface Driverpublic String hwVersion()
Driverpublic String swVersion()
Driverpublic Driver parent()
Driverpublic List<Driver> parents()
Driverpublic Set<Class<? extends Behaviour>> behaviours()
Driverbehaviours in interface Driverpublic Class<? extends Behaviour> implementation(Class<? extends Behaviour> behaviour)
Driverimplementation in interface Driverbehaviour - behaviour interfacepublic boolean hasBehaviour(Class<? extends Behaviour> behaviourClass)
DriverhasBehaviour in interface DriverbehaviourClass - behaviour classpublic <T extends Behaviour> T createBehaviour(DriverData data, Class<T> behaviourClass)
DrivercreateBehaviour in interface DriverT - type of behaviourdata - driver data contextbehaviourClass - driver behaviour classpublic <T extends Behaviour> T createBehaviour(DriverHandler handler, Class<T> behaviourClass)
DrivercreateBehaviour in interface DriverT - type of behaviourhandler - driver handler contextbehaviourClass - driver behaviour classpublic Set<String> keys()
Annotationskeys in interface Annotationspublic String value(String key)
Annotationsvalue in interface Annotationskey - annotation keypublic Map<String,String> properties()
Driverproperties in interface Driverpublic String getProperty(String name)
DrivergetProperty in interface Drivername - property name