net.sourceforge.wurfl.core
Class HierarchyCapabilitiesHolder

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

public class HierarchyCapabilitiesHolder
extends Object
implements CapabilitiesHolder, Serializable

Gets the capabilities values iterating over the device hierarchy.

It is intended to those applications need to load few capabilities for each Device. Otherwise This class is very inefficient.

hierarchy is defined as ordered list from "generic" to root device.
Example:
"generic"->...->root

Version:
$Id: HierarchyCapabilitiesHolder.java 432 2010-05-06 12:12:53Z filippo.deluca $
Author:
Fantayeneh Asres Gizaw, Filippo De Luca
See Also:
WURFLModel.getDeviceHierarchy(ModelDevice), Serialized Form

Constructor Summary
HierarchyCapabilitiesHolder(List hierarchy)
          Build a HierarchyCapabilitiesHolder from ModelDevice hierarchy.
 
Method Summary
 Map getAllCapabilities()
          Returns all capability for the held ModelDevice.
 String getCapabilityValue(String capabilityName)
          Gets capability value iterating over the held ModelDevice hierarchy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HierarchyCapabilitiesHolder

public HierarchyCapabilitiesHolder(List hierarchy)
Build a HierarchyCapabilitiesHolder from ModelDevice hierarchy. To know how is defined hierarchy look at WURFLModel#getDeviceHierarchy(ModelDevice).

Parameters:
hierarchy - A ModelDevice hierarchy.
Method Detail

getCapabilityValue

public String getCapabilityValue(String capabilityName)
                          throws CapabilityNotDefinedException
Gets capability value iterating over the held ModelDevice hierarchy.

Specified by:
getCapabilityValue in interface CapabilitiesHolder
Parameters:
capabilityName - The name of capability to get value.
Returns:
The value of capability capabilityName
Throws:
CapabilityNotDefinedException - If the capability capabilityName is not defined in WURFL.

getAllCapabilities

public Map getAllCapabilities()
Returns all capability for the held ModelDevice.

This method is very inefficent. Where the need is to load all capabilities for one Device, the coiche is DefaultCapabilitiesHolder

Specified by:
getAllCapabilities in interface CapabilitiesHolder
Returns:
Map containing couple name-value of single Device.


Copyright © 2008-2010 WURFL-Pro srl. All Rights Reserved.