public class DefaultDeviceHandler extends Object implements DeviceHandler
DeviceHandler
that has default
implementations of a couple of FacetProvider
methods.Constructor and Description |
---|
DefaultDeviceHandler(AbstractDeviceInfo deviceInfo,
IpAddress ip)
Create a device handler for the specified device info and IP address.
|
Modifier and Type | Method and Description |
---|---|
DeviceInfo |
getDeviceInfo()
Returns the DeviceInfo instance associated with this handler.
|
<T extends Facet> |
getFacet(Class<T> facetClass)
Returns an implementation of the specified facet class, or null if that
facet is not supported by this provider.
|
Set<Class<? extends Facet>> |
getFacetClasses()
Returns the set of facet classes for the facets that this provider
provides.
|
Set<String> |
getFacetClassNames()
Returns the set of facet class names for the facets that this provider
provides.
|
IpAddress |
getIpAddress()
Returns the IP address of the device to which this handler is bound.
|
boolean |
isSupported(Class<? extends Facet> facetClass)
Returns true if the specified facet class is supported by this
provider.
|
String |
toString() |
public DefaultDeviceHandler(AbstractDeviceInfo deviceInfo, IpAddress ip)
deviceInfo
- device info contextip
- IP address of the target devicepublic DeviceInfo getDeviceInfo()
DeviceHandler
getDeviceInfo
in interface DeviceHandler
public IpAddress getIpAddress()
DeviceHandler
getIpAddress
in interface DeviceHandler
public Set<Class<? extends Facet>> getFacetClasses()
FacetProvider
getFacetClasses
in interface FacetProvider
public Set<String> getFacetClassNames()
FacetProvider
FacetProvider.getFacetClasses()
and populate the returned set with the result
of calling Class.getName()
on each class.getFacetClassNames
in interface FacetProvider
public boolean isSupported(Class<? extends Facet> facetClass)
FacetProvider
public boolean isSupported(Class<? extends Facet> facetClass) {
return FacetProvider.getFacetClasses()
().contains(facetClass);
}
isSupported
in interface FacetProvider
facetClass
- a facet classpublic <T extends Facet> T getFacet(Class<T> facetClass)
FacetProvider
getFacet
in interface FacetProvider
T
- Facet typefacetClass
- the class of the required facetCopyright © 2015. All Rights Reserved.