Package org.apache.commons.collections

Examples of org.apache.commons.collections.FunctorException


            Class cls = input.getClass();
            Method method = cls.getMethod(iMethodName, iParamTypes);
            return method.invoke(input, iArgs);
               
        } catch (NoSuchMethodException ex) {
            throw new FunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" + input.getClass() + "' does not exist");
        } catch (IllegalAccessException ex) {
            throw new FunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" + input.getClass() + "' cannot be accessed");
        } catch (InvocationTargetException ex) {
            throw new FunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" + input.getClass() + "' threw an exception", ex);
        }
    }
View Full Code Here


    /**
     * Always throw an exception.
     */
    public void execute(Object object) {
        throw new FunctorException("ExceptionClosure invoked");
    }
View Full Code Here

        try {
            return iConstructor.newInstance(iArgs);

        } catch (InstantiationException ex) {
            throw new FunctorException("InstantiateFactory: InstantiationException", ex);
        } catch (IllegalAccessException ex) {
            throw new FunctorException("InstantiateFactory: Constructor must be public", ex);
        } catch (InvocationTargetException ex) {
            throw new FunctorException("InstantiateFactory: Constructor threw an exception", ex);
        }
    }
View Full Code Here

    /**
     * Return true if the object equals null else call the decorated predicate.
     */
    public boolean evaluate(Object object) {
        if (object == null) {
            throw new FunctorException("Input Object must not be null");
        }
        return iPredicate.evaluate(object);
    }
View Full Code Here

     * Return the result of instantiating the input Class object.
     */
    public Object transform(Object input) {
        try {
            if (input instanceof Class == false) {
                throw new FunctorException(
                    "InstantiateTransformer: Input object was not an instanceof Class, it was a "
                        + (input == null ? "null object" : input.getClass().getName()));
            }
            Constructor con = ((Class) input).getConstructor(iParamTypes);
            return con.newInstance(iArgs);

        } catch (NoSuchMethodException ex) {
            throw new FunctorException("InstantiateTransformer: The constructor must exist and be public ");
        } catch (InstantiationException ex) {
            throw new FunctorException("InstantiateTransformer: InstantiationException", ex);
        } catch (IllegalAccessException ex) {
            throw new FunctorException("InstantiateTransformer: Constructor must be public", ex);
        } catch (InvocationTargetException ex) {
            throw new FunctorException("InstantiateTransformer: Constructor threw an exception", ex);
        }
    }
View Full Code Here

            try {
                return iCloneMethod.invoke(iPrototype, null);

            } catch (IllegalAccessException ex) {
                throw new FunctorException("PrototypeCloneFactory: Clone method must be public", ex);
            } catch (InvocationTargetException ex) {
                throw new FunctorException("PrototypeCloneFactory: Clone method threw an exception", ex);
            }
        }
View Full Code Here

                bais = new ByteArrayInputStream(baos.toByteArray());
                ObjectInputStream in = new ObjectInputStream(bais);
                return in.readObject();

            } catch (ClassNotFoundException ex) {
                throw new FunctorException(ex);
            } catch (IOException ex) {
                throw new FunctorException(ex);
            } finally {
                try {
                    if (bais != null) {
                        bais.close();
                    }
View Full Code Here

     * Return the predicate result.
     */
    public boolean evaluate(Object object) {
        Object result = iTransformer.transform(object);
        if (result instanceof Boolean == false) {
            throw new FunctorException(
                "Transformer must return an instanceof Boolean, it was a "
                    + (result == null ? "null object" : result.getClass().getName()));
        }
        return ((Boolean) result).booleanValue();
    }
View Full Code Here

    /**
     * Always throw an exception.
     */
    public Object transform(Object object) {
        throw new FunctorException("ExceptionTransformer invoked");
    }
View Full Code Here

    /**
     * Always throw an exception
     */
    public boolean evaluate(Object object) {
        throw new FunctorException("ExceptionPredicate invoked");
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.FunctorException

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.