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 934 2012-03-27 13:34:26Z fulvio.crivellaro $
See Also:
WURFLModel.getDeviceHierarchy(ModelDevice), Serialized Form

Constructor Summary
HierarchyCapabilitiesHolder(List<ModelDevice> hierarchy)
          Build a HierarchyCapabilitiesHolder from ModelDevice hierarchy.
 
Method Summary
 Map<String,String> 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<ModelDevice> 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<String,String> 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 © 2012 ScientiaMobile Inc.. All Rights Reserved.