com.googlecode.sarasvati.impl
Class NestedReadEnv

java.lang.Object
  extended by com.googlecode.sarasvati.impl.NestedReadEnv
All Implemented Interfaces:
ReadEnv

public class NestedReadEnv
extends Object
implements ReadEnv


Constructor Summary
NestedReadEnv(ReadEnv outerEnv, ReadEnv innerEnv)
           
 
Method Summary
 String getAttribute(String name)
          Gets an attribute as a String.
<T> T
getAttribute(String name, Class<T> type)
          Returns the given attribute, transformed into the given type.
<T> T
getAttribute(String name, Class<T> type, T defaultValue)
          Returns the given attribute, transformed into the given type.
 Iterable<String> getAttributeNames()
          Returns an Iterable of attribute names.
 boolean hasAttribute(String name)
          Checks if the given attribute is present.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NestedReadEnv

public NestedReadEnv(ReadEnv outerEnv,
                     ReadEnv innerEnv)
Method Detail

getAttributeNames

public Iterable<String> getAttributeNames()
Description copied from interface: ReadEnv
Returns an Iterable of attribute names.

Specified by:
getAttributeNames in interface ReadEnv
Returns:
Iterable of attribute names

getAttribute

public String getAttribute(String name)
Description copied from interface: ReadEnv
Gets an attribute as a String. If there is no value set for the attribute, null will be returned.

Specified by:
getAttribute in interface ReadEnv
Parameters:
name - The name of the attribute to get
Returns:
The value of attribute or null if no value is set for the attribute.

getAttribute

public <T> T getAttribute(String name,
                          Class<T> type)
Description copied from interface: ReadEnv
Returns the given attribute, transformed into the given type.

Specified by:
getAttribute in interface ReadEnv
Type Parameters:
T - The type which the attribute should be returned as.
Parameters:
name - The name of the attribute to get.
type - The class type which the attribute should be transformed to.
Returns:
The attribute value, or null if no value is set for the attribute.

getAttribute

public <T> T getAttribute(String name,
                          Class<T> type,
                          T defaultValue)
Description copied from interface: ReadEnv
Returns the given attribute, transformed into the given type. If no value is set, return the given default.

Specified by:
getAttribute in interface ReadEnv
Type Parameters:
T - The type which the attribute should be returned as.
Parameters:
name - The name of the attribute to get.
type - The class type which the attribute should be transformed to.
defaultValue - The value to return if no value is set.
Returns:
The attribute value, or null if no value is set for the attribute.

hasAttribute

public boolean hasAttribute(String name)
Description copied from interface: ReadEnv
Checks if the given attribute is present.

Specified by:
hasAttribute in interface ReadEnv
Parameters:
name - Name of the attribute to check for
Returns:
True if the given attribute is present, false otherwise.