org.apache.cocoon.components.slide.impl
Class SlideConfigurationAdapter

java.lang.Object
  extended by org.apache.cocoon.components.slide.impl.SlideConfigurationAdapter
All Implemented Interfaces:
org.apache.slide.util.conf.Configuration

public class SlideConfigurationAdapter
extends Object
implements org.apache.slide.util.conf.Configuration

The class represent an adapter for the configuration class from jakarta slide

Version:
CVS $Id: SlideConfigurationAdapter.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Constructor Summary
SlideConfigurationAdapter(Configuration configuration)
          Create a new adapter to map a Avalon configuration to a Slide configuration
 
Method Summary
 String getAttribute(String paramName)
          Return the value of specified attribute.
 String getAttribute(String name, String defaultValue)
          Returns the value of the attribute specified by its name as a String, or the default value if no attribute by that name exists or is empty.
 boolean getAttributeAsBoolean(String paramName)
          Return the boolean value of the specified parameter contained in this node.
 boolean getAttributeAsBoolean(String name, boolean defaultValue)
          Returns the value of the attribute specified by its name as a boolean, or the default value if no attribute by that name exists or is empty.
 float getAttributeAsFloat(String paramName)
          Return the float value of the specified parameter contained in this node.
 float getAttributeAsFloat(String name, float defaultValue)
          Returns the value of the attribute specified by its name as a float, or the default value if no attribute by that name exists or is empty.
 int getAttributeAsInt(String paramName)
          Return the int value of the specified attribute contained in this node.
 int getAttributeAsInt(String name, int defaultValue)
          Returns the value of the attribute specified by its name as a int, or the default value if no attribute by that name exists or is empty.
 long getAttributeAsLong(String name)
          Returns the value of the attribute specified by its name as a long.
 long getAttributeAsLong(String name, long defaultValue)
          Returns the value of the attribute specified by its name as a long, or the default value if no attribute by that name exists or is empty.
 org.apache.slide.util.conf.Configuration getConfiguration(String child)
          Return a new Configuration instance encapsulating the specified child node.
 Enumeration getConfigurations(String name)
          Return an Enumeration of Configuration elements containing all node children with the specified name.
 String getLocation()
          Return a String indicating the position of this configuration element in a source file or URI.
 String getName()
          Return the name of the node.
 String getValue()
          Return the String value of the node.
 String getValue(String defaultValue)
          Returns the value of the configuration element as a String.
 boolean getValueAsBoolean()
          Return the boolean value of the node.
 boolean getValueAsBoolean(boolean defaultValue)
          Returns the value of the configuration element as a boolean.
 float getValueAsFloat()
          Return the float value of the node.
 float getValueAsFloat(float defaultValue)
          Returns the value of the configuration element as a float.
 int getValueAsInt()
          Return the int value of the node.
 int getValueAsInt(int defaultValue)
          Returns the value of the configuration element as an int.
 long getValueAsLong()
          Return the long value of the node.
 long getValueAsLong(long defaultValue)
          Returns the value of the configuration element as a long.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SlideConfigurationAdapter

public SlideConfigurationAdapter(Configuration configuration)
Create a new adapter to map a Avalon configuration to a Slide configuration

Parameters:
configuration - Avalon configuration
Method Detail

getName

public String getName()
Return the name of the node.

Specified by:
getName in interface org.apache.slide.util.conf.Configuration
Returns:
name of the Configuration node.

getConfiguration

public org.apache.slide.util.conf.Configuration getConfiguration(String child)
                                                          throws org.apache.slide.util.conf.ConfigurationException
Return a new Configuration instance encapsulating the specified child node.

Specified by:
getConfiguration in interface org.apache.slide.util.conf.Configuration
Parameters:
child - The name of the child node.
Returns:
Configuration
Throws:
org.apache.slide.util.conf.ConfigurationException - If no child with that name exists.

getConfigurations

public Enumeration getConfigurations(String name)
Return an Enumeration of Configuration elements containing all node children with the specified name.

Specified by:
getConfigurations in interface org.apache.slide.util.conf.Configuration
Parameters:
name - The name of the children to get.
Returns:
Enumeration. The Enumeration will be empty if there are no nodes by the specified name.

getAttribute

public String getAttribute(String paramName)
                    throws org.apache.slide.util.conf.ConfigurationException
Return the value of specified attribute.

Specified by:
getAttribute in interface org.apache.slide.util.conf.Configuration
Parameters:
paramName - The name of the parameter you ask the value of.
Returns:
String value of attribute.
Throws:
org.apache.slide.util.conf.ConfigurationException - If no attribute with that name exists.

getAttributeAsInt

public int getAttributeAsInt(String paramName)
                      throws org.apache.slide.util.conf.ConfigurationException
Return the int value of the specified attribute contained in this node.

Specified by:
getAttributeAsInt in interface org.apache.slide.util.conf.Configuration
Parameters:
paramName - The name of the parameter you ask the value of.
Returns:
int value of attribute
Throws:
org.apache.slide.util.conf.ConfigurationException - If no parameter with that name exists. or if conversion to int fails.

getAttributeAsLong

public long getAttributeAsLong(String name)
                        throws org.apache.slide.util.conf.ConfigurationException
Returns the value of the attribute specified by its name as a long.

Specified by:
getAttributeAsLong in interface org.apache.slide.util.conf.Configuration
Parameters:
name -
Returns:
long value of attribute
Throws:
org.apache.slide.util.conf.ConfigurationException - If no parameter with that name exists. or if conversion to long fails.

getAttributeAsFloat

public float getAttributeAsFloat(String paramName)
                          throws org.apache.slide.util.conf.ConfigurationException
Return the float value of the specified parameter contained in this node.

Specified by:
getAttributeAsFloat in interface org.apache.slide.util.conf.Configuration
Parameters:
paramName - The name of the parameter you ask the value of.
Returns:
float value of attribute
Throws:
org.apache.slide.util.conf.ConfigurationException - If no parameter with that name exists. or if conversion to float fails.

getAttributeAsBoolean

public boolean getAttributeAsBoolean(String paramName)
                              throws org.apache.slide.util.conf.ConfigurationException
Return the boolean value of the specified parameter contained in this node.

Specified by:
getAttributeAsBoolean in interface org.apache.slide.util.conf.Configuration
Parameters:
paramName - The name of the parameter you ask the value of.
Returns:
boolean value of attribute
Throws:
org.apache.slide.util.conf.ConfigurationException - If no parameter with that name exists. or if conversion to boolean fails.

getValue

public String getValue()
Return the String value of the node.

Specified by:
getValue in interface org.apache.slide.util.conf.Configuration
Returns:
the value of the node.

getValueAsInt

public int getValueAsInt()
                  throws org.apache.slide.util.conf.ConfigurationException
Return the int value of the node.

Specified by:
getValueAsInt in interface org.apache.slide.util.conf.Configuration
Returns:
the value of the node.
Throws:
org.apache.slide.util.conf.ConfigurationException - If conversion to int fails.

getValueAsFloat

public float getValueAsFloat()
                      throws org.apache.slide.util.conf.ConfigurationException
Return the float value of the node.

Specified by:
getValueAsFloat in interface org.apache.slide.util.conf.Configuration
Returns:
the value of the node.
Throws:
org.apache.slide.util.conf.ConfigurationException - If conversion to float fails.

getValueAsBoolean

public boolean getValueAsBoolean()
                          throws org.apache.slide.util.conf.ConfigurationException
Return the boolean value of the node.

Specified by:
getValueAsBoolean in interface org.apache.slide.util.conf.Configuration
Returns:
the value of the node.
Throws:
org.apache.slide.util.conf.ConfigurationException - If conversion to boolean fails.

getValueAsLong

public long getValueAsLong()
                    throws org.apache.slide.util.conf.ConfigurationException
Return the long value of the node.

Specified by:
getValueAsLong in interface org.apache.slide.util.conf.Configuration
Returns:
the value of the node.
Throws:
org.apache.slide.util.conf.ConfigurationException - If conversion to long fails.

getValue

public String getValue(String defaultValue)
Returns the value of the configuration element as a String. If the configuration value is not set, the default value will be used.

Specified by:
getValue in interface org.apache.slide.util.conf.Configuration
Parameters:
defaultValue - The default value desired.
Returns:
String value of the Configuration, or default if none specified.

getValueAsInt

public int getValueAsInt(int defaultValue)
Returns the value of the configuration element as an int. If the configuration value is not set, the default value will be used.

Specified by:
getValueAsInt in interface org.apache.slide.util.conf.Configuration
Parameters:
defaultValue - The default value desired.
Returns:
int value of the Configuration, or default if none specified.

getValueAsLong

public long getValueAsLong(long defaultValue)
Returns the value of the configuration element as a long. If the configuration value is not set, the default value will be used.

Specified by:
getValueAsLong in interface org.apache.slide.util.conf.Configuration
Parameters:
defaultValue - The default value desired.
Returns:
long value of the Configuration, or default if none specified.

getValueAsFloat

public float getValueAsFloat(float defaultValue)
Returns the value of the configuration element as a float. If the configuration value is not set, the default value will be used.

Specified by:
getValueAsFloat in interface org.apache.slide.util.conf.Configuration
Parameters:
defaultValue - The default value desired.
Returns:
float value of the Configuration, or default if none specified.

getValueAsBoolean

public boolean getValueAsBoolean(boolean defaultValue)
Returns the value of the configuration element as a boolean. If the configuration value is not set, the default value will be used.

Specified by:
getValueAsBoolean in interface org.apache.slide.util.conf.Configuration
Parameters:
defaultValue - The default value desired.
Returns:
boolean value of the Configuration, or default if none specified.

getAttribute

public String getAttribute(String name,
                           String defaultValue)
Returns the value of the attribute specified by its name as a String, or the default value if no attribute by that name exists or is empty.

Specified by:
getAttribute in interface org.apache.slide.util.conf.Configuration
Parameters:
name - The name of the attribute you ask the value of.
defaultValue - The default value desired.
Returns:
String value of attribute. It will return the default value if the named attribute does not exist, or if the value is not set.

getAttributeAsInt

public int getAttributeAsInt(String name,
                             int defaultValue)
Returns the value of the attribute specified by its name as a int, or the default value if no attribute by that name exists or is empty.

Specified by:
getAttributeAsInt in interface org.apache.slide.util.conf.Configuration
Parameters:
name - The name of the attribute you ask the value of.
defaultValue - The default value desired.
Returns:
int value of attribute. It will return the default value if the named attribute does not exist, or if the value is not set.

getAttributeAsLong

public long getAttributeAsLong(String name,
                               long defaultValue)
Returns the value of the attribute specified by its name as a long, or the default value if no attribute by that name exists or is empty.

Specified by:
getAttributeAsLong in interface org.apache.slide.util.conf.Configuration
Parameters:
name - The name of the attribute you ask the value of.
defaultValue - The default value desired.
Returns:
long value of attribute. It will return the default value if the named attribute does not exist, or if the value is not set.

getAttributeAsFloat

public float getAttributeAsFloat(String name,
                                 float defaultValue)
Returns the value of the attribute specified by its name as a float, or the default value if no attribute by that name exists or is empty.

Specified by:
getAttributeAsFloat in interface org.apache.slide.util.conf.Configuration
Parameters:
name - The name of the attribute you ask the value of.
defaultValue - The default value desired.
Returns:
float value of attribute. It will return the default value if the named attribute does not exist, or if the value is not set.

getAttributeAsBoolean

public boolean getAttributeAsBoolean(String name,
                                     boolean defaultValue)
Returns the value of the attribute specified by its name as a boolean, or the default value if no attribute by that name exists or is empty.

Specified by:
getAttributeAsBoolean in interface org.apache.slide.util.conf.Configuration
Parameters:
name - The name of the attribute you ask the value of.
defaultValue - The default value desired.
Returns:
boolean value of attribute. It will return the default value if the named attribute does not exist, or if the value is not set.

getLocation

public String getLocation()
Return a String indicating the position of this configuration element in a source file or URI.

Specified by:
getLocation in interface org.apache.slide.util.conf.Configuration
Returns:
String if a source file or URI is specified. Otherwise it returns null


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.