public abstract class AbstractDeviceInfo extends Object implements MutableDeviceInfo
DeviceInfo
that has default
implementations of a couple of FacetProvider
methods.
Note that this class implements MutableDeviceInfo
, allowing
implementations access to their DeviceType
reference.Constructor and Description |
---|
AbstractDeviceInfo(DefaultDeviceType deviceType)
Creates a device info associated with the specified device type.
|
Modifier and Type | Method and Description |
---|---|
DeviceType |
getDeviceType()
Returns the device type that this device info instance is backed by.
|
<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.
|
DefaultDeviceType |
getType()
Downcast the DeviceType to AbstractDeviceType.
|
String |
getTypeName()
Returns the name of the device type backing this instance.
|
boolean |
isSupported(Class<? extends Facet> facetClass)
Returns true if the specified facet class is supported by this
provider.
|
void |
setDeviceType(DeviceType type)
Sets the device type for this device info instance.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
evolve, exportData, getGeneration, importData
public AbstractDeviceInfo(DefaultDeviceType deviceType)
deviceType
- backing device typepublic DefaultDeviceType getType()
public String getTypeName()
DeviceInfo
getTypeName
in interface DeviceInfo
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 facetpublic DeviceType getDeviceType()
MutableDeviceInfo
getDeviceType
in interface MutableDeviceInfo
public void setDeviceType(DeviceType type)
MutableDeviceInfo
setDeviceType
in interface MutableDeviceInfo
type
- the device typeCopyright © 2015. All Rights Reserved.