org.codehaus.groovy.grails.commons.metaclass
Class LazyMetaPropertyMap

java.lang.Object
  extended by org.codehaus.groovy.grails.commons.metaclass.LazyMetaPropertyMap
All Implemented Interfaces:
Map
Direct Known Subclasses:
DataBindingLazyMetaPropertyMap

public class LazyMetaPropertyMap
extends Object
implements Map

A map implementation that reads an objects properties lazily using Groovy's MetaClass

Author:
Graeme Rocher

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
LazyMetaPropertyMap(Object o)
          Constructs the map
 
Method Summary
 void clear()
           
 boolean containsKey(Object propertyName)
           
 boolean containsValue(Object o)
          Checks whether the specified value is contained within the Map.
 Set entrySet()
           
 boolean equals(Object o)
           
 Object get(Object propertyName)
          Obtains the value of an object's properties on demand using Groovy's MOP
 Object getInstance()
          Returns the wrapped instance
 int hashCode()
           
 boolean isEmpty()
           
 Set keySet()
           
 Object put(Object propertyName, Object propertyValue)
           
 void putAll(Map map)
           
 Object remove(Object o)
           
 int size()
           
 Collection values()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyMetaPropertyMap

public LazyMetaPropertyMap(Object o)
Constructs the map

Parameters:
o - The object to inspect
Method Detail

size

public int size()
Specified by:
size in interface Map
See Also:
Map.size()

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map
See Also:
Map.isEmpty()

containsKey

public boolean containsKey(Object propertyName)
Specified by:
containsKey in interface Map
See Also:
Map.containsKey(Object)

containsValue

public boolean containsValue(Object o)
Checks whether the specified value is contained within the Map. Note that because this implementation lazily initialises property values the behaviour may not be consistent with the actual values of the contained object unless they have already been initialised by calling get(Object)

Specified by:
containsValue in interface Map
See Also:
Map.containsValue(Object)

get

public Object get(Object propertyName)
Obtains the value of an object's properties on demand using Groovy's MOP

Specified by:
get in interface Map
Parameters:
propertyName - The name of the property
Returns:
The property value or null

put

public Object put(Object propertyName,
                  Object propertyValue)
Specified by:
put in interface Map

remove

public Object remove(Object o)
Specified by:
remove in interface Map
Throws:
UnsupportedOperationException

putAll

public void putAll(Map map)
Specified by:
putAll in interface Map

clear

public void clear()
Specified by:
clear in interface Map
Throws:
UnsupportedOperationException

keySet

public Set keySet()
Specified by:
keySet in interface Map

values

public Collection values()
Specified by:
values in interface Map

hashCode

public int hashCode()
Specified by:
hashCode in interface Map
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Specified by:
equals in interface Map
Overrides:
equals in class Object

getInstance

public Object getInstance()
Returns the wrapped instance

Returns:
The wrapped instance

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map


Copyright (c) 2005-2009 The Grails project