Class LazyMetaPropertyMap

  • All Implemented Interfaces:
    java.util.Map

    @CompileStatic
    public class LazyMetaPropertyMap
    extends java.lang.Object
    implements java.util.Map
    A map implementation that reads an objects properties lazily using Groovy's MetaClass.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      LazyMetaPropertyMap​(java.lang.Object o)
      Constructs the map
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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<groovy.util.MapEntry> 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<java.lang.String> 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<java.lang.Object> values()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
    • 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(java.lang.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<java.lang.String> keySet()
        Specified by:
        keySet in interface java.util.Map
      • values

        public java.util.Collection<java.lang.Object> 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<groovy.util.MapEntry> entrySet()
        Specified by:
        entrySet in interface java.util.Map