Package groovy.lang

Examples of groovy.lang.MissingMethodException


    public Object invoke(CachedMethod method, Object object, Object[] arguments) {
        return noSuchMethod(method, object, arguments);
    }

    protected Object noSuchMethod(CachedMethod method, Object object, Object[] arguments) {
        throw new MissingMethodException(method.getName(), method.getDeclaringClass().getCachedClass(), arguments, false);
    }
View Full Code Here


                    return respondsTo.get(0).invoke(tagLibrary, args);
                }
            }
        }

        throw new MissingMethodException(methodName, instance.getClass(), args);
    }
View Full Code Here

                if (current == Environment.CUSTOM && current.getName().equals(name)) {
                    callable = (Closure<?>) argsArray[0];
                }
                return null;
            }
            throw new MissingMethodException(name, Environment.class, argsArray);
        }
View Full Code Here

     * @return null
     */
    public Object redirect(Object target, Map argMap) {

        if (argMap.isEmpty()) {
            throw new MissingMethodException("redirect",target.getClass(),new Object[]{ argMap });
        }

        GrailsWebRequest webRequest = (GrailsWebRequest)RequestContextHolder.currentRequestAttributes();

        if(target instanceof GroovyObject) {
View Full Code Here

                cp = (ConstrainedProperty)constrainedProperties.get(property);
            }
            else {
                Class<?> propertyType = classPropertyFetcher.getPropertyType(property);
                if (propertyType == null) {
                    throw new MissingMethodException(property, targetClass, new Object[]{attributes}, true);
                }
                cp = new ConstrainedProperty(targetClass, property, propertyType);
                cp.setOrder(order++);
                constrainedProperties.put(property, cp);
            }

            if (cp.getPropertyType() == null) {
                if (!IMPORT_FROM_CONSTRAINT.equals(name)) {
                    GrailsUtil.warn("Property [" + cp.getPropertyName() + "] not found in domain class " +
                        targetClass.getName() + "; cannot apply constraints: " + attributes);
                }
                return cp;
            }

            for (Object o : attributes.keySet()) {
                String constraintName = (String) o;
                final Object value = attributes.get(constraintName);
                if (SHARED_CONSTRAINT.equals(constraintName)) {
                    if (value != null) {
                        sharedConstraints.put(property, value.toString());
                    }
                    continue;
                }
                if (cp.supportsContraint(constraintName)) {
                    cp.applyConstraint(constraintName, value);
                }
                else {
                    if (ConstrainedProperty.hasRegisteredConstraint(constraintName)) {
                        // constraint is registered but doesn't support this property's type
                        GrailsUtil.warn("Property [" + cp.getPropertyName() + "] of domain class " +
                                targetClass.getName() + " has type [" + cp.getPropertyType().getName() +
                                "] and doesn't support constraint [" + constraintName +
                                "]. This constraint will not be checked during validation.");
                    }
                    else {
                        // in the case where the constraint is not supported we still retain meta data
                        // about the constraint in case its needed for other things
                        cp.addMetaConstraint(constraintName, value);
                    }
                }
            }

            return cp;
        }
        catch(InvalidPropertyException ipe) {
            throw new MissingMethodException((String)name,targetClass,new Object[]{ attributes});
        }
    }
View Full Code Here

    @Override
    protected Object createNode(Object name, Map attributes, Object value) {
        if (IMPORT_FROM_CONSTRAINT.equals(name) && (value instanceof Class)) {
            return handleImportFrom(attributes, (Class) value);
        }
        throw new MissingMethodException((String)name,targetClass,new Object[]{ attributes,value});
    }
View Full Code Here

        }
        Object value = ctx.getAttribute(name);
        if (value instanceof Closure) {
            return ((Closure) value).call(args);
        } else {
            throw new MissingMethodException(name, getClass(), args);
        }
    }
View Full Code Here

        final DataflowVariable<Object> df = ensureToContainVariable(name);
        if (args instanceof Object[] && ((Object[]) args).length == 1 && ((Object[]) args)[0] instanceof Closure) {
            df.whenBound((Closure) ((Object[]) args)[0]);
            return this;
        } else
            throw new MissingMethodException(name, Dataflows.class, (Object[]) args);
    }
View Full Code Here

     */
    public Object methodMissing(String name, Object args) {
        try {
            return InvokerHelper.invokeMethod(getDelegate(), name, args);
        } catch (MissingMethodException mme) {
            throw new MissingMethodException(name, getClass(), mme.getArguments());
        }
    }
View Full Code Here

            Object value = ctx.getAttribute(name);
            if (value instanceof Closure) {
                return ((Closure) value).call(args);
            } // else fall thru..
        }
        throw new MissingMethodException(name, getClass(), args);
    }
View Full Code Here

TOP

Related Classes of groovy.lang.MissingMethodException

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.