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 432 2010-05-06 12:12:53Z filippo.deluca $
Author:
Fantayeneh Asres Gizaw, Filippo De Luca
See Also:
Serialized Form

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

Constructor Detail

DefaultDevice

public DefaultDevice(ModelDevice root,
                     CapabilitiesHolder capabilitiesHolder,
                     MarkupResolver markupResolver)
Build a Device.

Parameters:
root - The ModelDevice instance root of this Device.
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 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.

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 © 2008-2010 WURFL-Pro srl. All Rights Reserved.