net.sourceforge.wurfl.core
Class DefaultDevice

java.lang.Object
  extended by net.sourceforge.wurfl.core.DefaultDevice
All Implemented Interfaces:
Serializable, Device

public class DefaultDevice
extends Object
implements Device, Serializable

This is a default Device implementation.

It uses a CapabilitiesHolder to retrieve capabilities values and MarkupResolver to resolve MarkUp.

Version:
$Id: DefaultDevice.java 934 2012-03-27 13:34:26Z fulvio.crivellaro $
See Also:
Serialized Form

Constructor Summary
protected DefaultDevice(ModelDevice modelDevice, String deviceRootId, CapabilitiesHolder capabilitiesHolder, MarkupResolver markupResolver)
           
protected DefaultDevice(ModelDevice modelDevice, String deviceRootId, CapabilitiesHolder capabilitiesHolder, MarkupResolver markupResolver, DeviceInfo info)
          Build a Device.
 
Method Summary
 boolean equals(Object obj)
           It assumes two DefaultDevices with equals root ModelDevices are equals.
 Map<String,String> getCapabilities()
          Returns a device's capabilities values by name Map.
 String getCapability(String name)
          Return a device's capability value.
 String getDeviceRootId()
          
 String getId()
          Return the WURFL id of this device
 MarkUp getMarkUp()
          Get the markUp handled by this device.
 String getMatcherName()
           
 MatchType getMatchType()
           
 String getUserAgent()
          Return the user-agent string for this device as defined in WURFL.
 int hashCode()
           
 boolean isActualDeviceRoot()
          
 boolean isGeneric()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultDevice

protected DefaultDevice(ModelDevice modelDevice,
                        String deviceRootId,
                        CapabilitiesHolder capabilitiesHolder,
                        MarkupResolver markupResolver)

DefaultDevice

protected DefaultDevice(ModelDevice modelDevice,
                        String deviceRootId,
                        CapabilitiesHolder capabilitiesHolder,
                        MarkupResolver markupResolver,
                        DeviceInfo info)
Build a Device.

Parameters:
modelDevice - The ModelDevice instance modelDevice of this Device.
deviceRootId - Ancestor id
capabilitiesHolder - The CapabilitiesHolder used to get capabilities values.
markupResolver - The MarkupResolver used to obtain MarkUp for this Device.
Method Detail

getId

public String getId()
Return the WURFL id of this device

Specified by:
getId in interface Device
Returns:
A string representing this device identifier.

getUserAgent

public String getUserAgent()
Return the user-agent string for this device as defined in WURFL.

Specified by:
getUserAgent in interface Device
Returns:
A String containing the defined user-agent.

getCapability

public String getCapability(String name)
                     throws CapabilityNotDefinedException
Return a device's capability value.

Specified by:
getCapability in interface Device
Parameters:
name - The identifier of capability to get.
Returns:
The value of capability.
Throws:
CapabilityNotDefinedException - If this device do not define the given capability.

getCapabilities

public Map<String,String> getCapabilities()
Returns a device's capabilities values by name Map.

Specified by:
getCapabilities in interface Device
Returns:
Map containing couples name-value of device's capabilities.

getMarkUp

public MarkUp getMarkUp()
Get the markUp handled by this device.

Specified by:
getMarkUp in interface Device
Returns:
A MarkUp instance this device can handle.

isActualDeviceRoot

public boolean isActualDeviceRoot()

Specified by:
isActualDeviceRoot in interface Device
Returns:
if it is a real device.

getDeviceRootId

public String getDeviceRootId()

Specified by:
getDeviceRootId in interface Device
Returns:
id of ancestor device.

isGeneric

public boolean isGeneric()
Specified by:
isGeneric in interface Device
Returns:
true if this is a generic device, not totally identified.

getMatchType

public MatchType getMatchType()
Specified by:
getMatchType in interface Device
Returns:
info about the match type that found the device.

getMatcherName

public String getMatcherName()

equals

public boolean equals(Object obj)
It assumes two DefaultDevices with equals root ModelDevices are equals.

Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012 ScientiaMobile Inc.. All Rights Reserved.