Class HandleMetaClass

    • Constructor Detail

      • HandleMetaClass

        public HandleMetaClass​(MetaClass mc)
      • HandleMetaClass

        public HandleMetaClass​(MetaClass mc,
                               java.lang.Object obj)
    • Method Detail

      • initialize

        public void initialize()
        Description copied from interface: MetaClass
        Complete the initialisation process. After this method is called no methods should be added to the meta class. Invocation of methods or access to fields/properties is forbidden unless this method is called. This method should contain any initialisation code, taking a longer time to complete. An example is the creation of the Reflector. It is suggested to synchronize this method.
        Specified by:
        initialize in interface MetaClass
        Overrides:
        initialize in class DelegatingMetaClass
      • invokeMethod

        public java.lang.Object invokeMethod​(java.lang.String name,
                                             java.lang.Object args)
        Description copied from interface: GroovyObject
        Invokes the given method.
        Specified by:
        invokeMethod in interface GroovyObject
        Overrides:
        invokeMethod in class DelegatingMetaClass
        Parameters:
        name - the name of the method to call
        args - the arguments to use for the method call
        Returns:
        the result of invoking the method
      • getProperty

        public java.lang.Object getProperty​(java.lang.String property)
        Description copied from interface: GroovyObject
        Retrieves a property value.
        Specified by:
        getProperty in interface GroovyObject
        Overrides:
        getProperty in class DelegatingMetaClass
        Parameters:
        property - the name of the property of interest
        Returns:
        the given property
      • setProperty

        public void setProperty​(java.lang.String property,
                                java.lang.Object newValue)
        Description copied from interface: GroovyObject
        Sets the given property to the new value.
        Specified by:
        setProperty in interface GroovyObject
        Overrides:
        setProperty in class DelegatingMetaClass
        Parameters:
        property - the name of the property of interest
        newValue - the new value for the property
      • addNewInstanceMethod

        public void addNewInstanceMethod​(java.lang.reflect.Method method)
        Description copied from interface: MutableMetaClass
        adds a new instance method to this MetaClass. Instance methods are able to overwrite the original methods of the class. Calling this method should not be done after initialise was called.
        Specified by:
        addNewInstanceMethod in interface MutableMetaClass
        Overrides:
        addNewInstanceMethod in class DelegatingMetaClass
        Parameters:
        method - the method to be added