Package org.codehaus.groovy.runtime.metaclass

Examples of org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod


      }

      private void addMethodWithKey(final MetaMethod metaMethodFromSuper) {
                inheritedMetaMethods.add(metaMethodFromSuper);
                if(metaMethodFromSuper instanceof ClosureMetaMethod) {
                    ClosureMetaMethod closureMethod = (ClosureMetaMethod)metaMethodFromSuper;
                    Closure cloned = (Closure)closureMethod.getClosure().clone();
                    String name = metaMethodFromSuper.getName();
                    ClosureMetaMethod localMethod = new ClosureMetaMethod(name, getJavaClass(), cloned);
                    addMetaMethod(localMethod);

                    MethodKey key = new DefaultCachedMethodKey(getJavaClass(),name, localMethod.getParameterTypes(),false );
//                    cacheInstanceMethod(key, localMethod);

                    checkIfGroovyObjectMethod(localMethod, name);
                    expandoMethods.put(key,localMethod);
View Full Code Here


   */
  protected void registerInstanceMethod(final String methodName, final Closure callable) {
      final boolean inited = this.initCalled;
      performOperationOnMetaClass(new Callable() {
        public void call() {
          ClosureMetaMethod metaMethod = new ClosureMetaMethod(methodName, theClass,callable);
                    checkIfGroovyObjectMethod(metaMethod, methodName);
                    MethodKey key = new DefaultCachedMethodKey(theClass,methodName, metaMethod.getParameterTypes(),false );


          addMetaMethod(metaMethod);
                    dropMethodCache(methodName);
                    expandoMethods.put(key,metaMethod);

          if(inited && isGetter(methodName, metaMethod.getParameterTypes())) {
            String propertyName = getPropertyForGetter(methodName);
            registerBeanPropertyForMethod(metaMethod, propertyName, true, false);

          }
          else if(inited && isSetter(methodName, metaMethod.getParameterTypes())) {
            String propertyName = getPropertyForSetter(methodName);
            registerBeanPropertyForMethod(metaMethod, propertyName, false, false);
          }
          performRegistryCallbacks();
        }
View Full Code Here

            }

            private void addMethodWithKey(final MetaMethod metaMethodFromSuper) {
                inheritedMetaMethods.add(metaMethodFromSuper);
                if (metaMethodFromSuper instanceof ClosureMetaMethod) {
                    ClosureMetaMethod closureMethod = (ClosureMetaMethod)metaMethodFromSuper;
                    String name = metaMethodFromSuper.getName();
                    final Class declaringClass = metaMethodFromSuper.getDeclaringClass().getTheClass();
                    ClosureMetaMethod localMethod = ClosureMetaMethod.copy(closureMethod);
                    addMetaMethod(localMethod);

                    MethodKey key = new DefaultCachedMethodKey(declaringClass, name, localMethod.getParameterTypes(), false);

                    checkIfGroovyObjectMethod(localMethod);
                    expandoMethods.put(key, localMethod);

                }
View Full Code Here

            }

            private void addMethodWithKey(final MetaMethod metaMethodFromSuper) {
                inheritedMetaMethods.add(metaMethodFromSuper);
                if (metaMethodFromSuper instanceof ClosureMetaMethod) {
                    ClosureMetaMethod closureMethod = (ClosureMetaMethod) metaMethodFromSuper;
                    Closure cloned = (Closure) closureMethod.getClosure().clone();
                    String name = metaMethodFromSuper.getName();
                    final Class declaringClass = metaMethodFromSuper.getDeclaringClass().getTheClass();
                    ClosureMetaMethod localMethod = ClosureMetaMethod.copy(closureMethod);
                    addMetaMethod(localMethod);

                    MethodKey key = new DefaultCachedMethodKey(declaringClass, name, localMethod.getParameterTypes(), false);
//                    cacheInstanceMethod(key, localMethod);

                    checkIfGroovyObjectMethod(localMethod);
                    expandoMethods.put(key, localMethod);
View Full Code Here

      }

      private void addMethodWithKey(final MetaMethod metaMethodFromSuper) {
                inheritedMetaMethods.add(metaMethodFromSuper);
                if(metaMethodFromSuper instanceof ClosureMetaMethod) {
                    ClosureMetaMethod closureMethod = (ClosureMetaMethod)metaMethodFromSuper;
                    Closure cloned = (Closure)closureMethod.getClosure().clone();
                    String name = metaMethodFromSuper.getName();
                    ClosureMetaMethod localMethod = new ClosureMetaMethod(name, getJavaClass(), cloned);
                    addMetaMethod(localMethod);

                    MethodKey key = new DefaultCachedMethodKey(getJavaClass(),name, localMethod.getParameterTypes(),false );
//                    cacheInstanceMethod(key, localMethod);

                    checkIfGroovyObjectMethod(localMethod, name);
                    expandoMethods.put(key,localMethod);
View Full Code Here

   */
  protected void registerInstanceMethod(final String methodName, final Closure callable) {
      final boolean inited = this.initCalled;
      performOperationOnMetaClass(new Callable() {
        public void call() {
          ClosureMetaMethod metaMethod = new ClosureMetaMethod(methodName, theClass,callable);
                    checkIfGroovyObjectMethod(metaMethod, methodName);
                    MethodKey key = new DefaultCachedMethodKey(theClass,methodName, metaMethod.getParameterTypes(),false );


          addMetaMethod(metaMethod);
                    dropMethodCache(methodName);
                    expandoMethods.put(key,metaMethod);

          if(inited && isGetter(methodName, metaMethod.getParameterTypes())) {
            String propertyName = getPropertyForGetter(methodName);
            registerBeanPropertyForMethod(metaMethod, propertyName, true, false);

          }
          else if(inited && isSetter(methodName, metaMethod.getParameterTypes())) {
            String propertyName = getPropertyForSetter(methodName);
            registerBeanPropertyForMethod(metaMethod, propertyName, false, false);
          }
          performRegistryCallbacks();
        }
View Full Code Here

            }

            private void addMethodWithKey(final MetaMethod metaMethodFromSuper) {
                inheritedMetaMethods.add(metaMethodFromSuper);
                if (metaMethodFromSuper instanceof ClosureMetaMethod) {
                    ClosureMetaMethod closureMethod = (ClosureMetaMethod)metaMethodFromSuper;
                    String name = metaMethodFromSuper.getName();
                    final Class declaringClass = metaMethodFromSuper.getDeclaringClass().getTheClass();
                    ClosureMetaMethod localMethod = ClosureMetaMethod.copy(closureMethod);
                    addMetaMethod(localMethod);

                    MethodKey key = new DefaultCachedMethodKey(declaringClass, name, localMethod.getParameterTypes(), false);

                    checkIfGroovyObjectMethod(localMethod);
                    expandoMethods.put(key, localMethod);

                }
View Full Code Here

            }

            private void addMethodWithKey(final MetaMethod metaMethodFromSuper) {
                inheritedMetaMethods.add(metaMethodFromSuper);
                if (metaMethodFromSuper instanceof ClosureMetaMethod) {
                    ClosureMetaMethod closureMethod = (ClosureMetaMethod) metaMethodFromSuper;
                    Closure cloned = (Closure) closureMethod.getClosure().clone();
                    String name = metaMethodFromSuper.getName();
                    final Class declaringClass = metaMethodFromSuper.getDeclaringClass().getTheClass();
                    ClosureMetaMethod localMethod = ClosureMetaMethod.copy(closureMethod);
                    addMetaMethod(localMethod);

                    MethodKey key = new DefaultCachedMethodKey(declaringClass, name, localMethod.getParameterTypes(), false);
//                    cacheInstanceMethod(key, localMethod);

                    checkIfGroovyObjectMethod(localMethod);
                    expandoMethods.put(key, localMethod);
View Full Code Here

TOP

Related Classes of org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.