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

java.lang.Object
  extended by org.codehaus.groovy.grails.commons.metaclass.LazyMetaPropertyMap
All Implemented Interfaces:
java.util.Map

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

Constructor Detail

LazyMetaPropertyMap

public LazyMetaPropertyMap(java.lang.Object o)
Constructs the map

Parameters:
o - The object to inspect
Method Detail

size

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

isEmpty

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

containsKey

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

containsValue

public boolean containsValue(java.lang.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 java.util.Map
See Also:
Map.containsValue(Object)

get

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

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

put

public java.lang.Object put(java.lang.Object propertyName,
                            java.lang.Object propertyValue)
Specified by:
put in interface java.util.Map

remove

public java.lang.Object remove(java.lang.Object o)
Specified by:
remove in interface java.util.Map
Throws:
java.lang.UnsupportedOperationException

putAll

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

clear

public void clear()
Specified by:
clear in interface java.util.Map
Throws:
java.lang.UnsupportedOperationException

keySet

public java.util.Set keySet()
Specified by:
keySet in interface java.util.Map

values

public java.util.Collection values()
Specified by:
values in interface java.util.Map

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Map
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Map
Overrides:
equals in class java.lang.Object

getInstance

public java.lang.Object getInstance()
Returns the wrapped instance

Returns:
The wrapped instance

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map


Copyright (c) 2005-2006 The Grails project