Examples of respondsTo()


Examples of groovy.lang.MetaClass.respondsTo()

            return invokeBeanDefiningMethod(name, args);
        }

        ApplicationContext ctx = springConfig.getUnrefreshedApplicationContext();
        MetaClass mc = DefaultGroovyMethods.getMetaClass(ctx);
        if (!mc.respondsTo(ctx, name, args).isEmpty()) {
            return mc.invokeMethod(ctx,name, args);
        }

        return this;
    }
View Full Code Here

Examples of groovy.lang.MetaClass.respondsTo()

        callDynamic("onTimeout", EMPTY_ARGUMENTS);
    }

    private boolean callDynamic(final String method, final Object[] args) {
        final MetaClass metaClass = InvokerHelper.getMetaClass(this);
        final List<MetaMethod> list = metaClass.respondsTo(this, method);
        if (list != null && !list.isEmpty()) {
            boolean hasArgs = false;
            for (final MetaMethod metaMethod : list) {
                if (metaMethod.getParameterTypes().length > 0) hasArgs = true;
            }
View Full Code Here

Examples of org.jruby.RubyClass.respondsTo()

                          }
                      });
                    } catch (JumpException e) { }
                    if (memoArray[1] != null) {
                        RubyClass klass = (RubyClass) memoArray[1];
                        if (klass.respondsTo("json_creatable?") &&
                            klass.callMethod(context, "json_creatable?").isTrue()) {
                            result = klass.callMethod(context, "json_create", result);
                        }
                    }
                }
View Full Code Here

Examples of org.jruby.RubyClass.respondsTo()

                          }
                      });
                    } catch (JumpException e) { }
                    if (memoArray[1] != null) {
                        RubyClass klass = (RubyClass) memoArray[1];
                        if (klass.respondsTo("json_creatable?") &&
                            klass.callMethod(context, "json_creatable?").isTrue()) {
                            result = klass.callMethod(context, "json_create", result);
                        }
                    }
                }
View Full Code Here

Examples of org.jruby.RubyClass.respondsTo()

                          }
                      });
                    } catch (JumpException e) { }
                    if (memoArray[1] != null) {
                        RubyClass klass = (RubyClass) memoArray[1];
                        if (klass.respondsTo("json_creatable?") &&
                            klass.callMethod(context, "json_creatable?").isTrue()) {
                            result = klass.callMethod(context, "json_create", result);
                        }
                    }
                }
View Full Code Here

Examples of org.jruby.RubyClass.respondsTo()

                          }
                      });
                    } catch (JumpException e) { }
                    if (memoArray[1] != null) {
                        RubyClass klass = (RubyClass) memoArray[1];
                        if (klass.respondsTo("json_creatable?") &&
                            klass.callMethod(context, "json_creatable?").isTrue()) {
                            result = klass.callMethod(context, "json_create", result);
                        }
                    }
                }
View Full Code Here

Examples of org.jruby.RubyClass.respondsTo()

                          }
                      });
                    } catch (JumpException e) { }
                    if (memoArray[1] != null) {
                        RubyClass klass = (RubyClass) memoArray[1];
                        if (klass.respondsTo("json_creatable?") &&
                            klass.callMethod(context, "json_creatable?").isTrue()) {
                            result = klass.callMethod(context, "json_create", result);
                        }
                    }
                }
View Full Code Here

Examples of org.jruby.RubyModule.respondsTo()

    private IRubyObject userUnmarshal() throws IOException {
        String className = unmarshalObject().asJavaString();
        ByteList marshaled = unmarshalString();
        RubyModule classInstance = findClass(className);
        if (!classInstance.respondsTo("_load")) {
            throw runtime.newTypeError("class " + classInstance.getName() + " needs to have method `_load'");
        }
        RubyString data = RubyString.newString(getRuntime(), marshaled);
        if (ivarsWaiting) {
            defaultVariablesUnmarshal(data);
View Full Code Here

Examples of org.jruby.RubyObject.respondsTo()

                return new Short(number.shortValue());
            }
        }
        if (isDuckTypeConvertable(argument.getClass(), parameterType)) {
            RubyObject rubyObject = (RubyObject) argument;
            if (!rubyObject.respondsTo("java_object")) {
                return convertProcToInterface(runtime.getCurrentContext(), rubyObject, parameterType);
            }
        }
        return argument;
    }
View Full Code Here

Examples of org.jruby.RubyObject.respondsTo()

    }
   
    public static Object coerceJavaObjectToType(ThreadContext context, Object javaObject, Class target) {
        if (javaObject != null && isDuckTypeConvertable(javaObject.getClass(), target)) {
            RubyObject rubyObject = (RubyObject) javaObject;
            if (!rubyObject.respondsTo("java_object")) {
                return convertProcToInterface(context, rubyObject, target);
            }

            // can't be converted any more, return it
            return javaObject;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.