Examples of ValangException


Examples of org.springmodules.validation.valang.ValangException

            if (dates) {
                return ((Date) leftValue).getTime() < ((Date) rightValue).getTime();
            } else if (numbers) {
                return ((BigDecimal) leftValue).compareTo((BigDecimal) rightValue) < 0;
            } else {
                throw new ValangException("< operator only supports two date or two number values!", getLine(), getColumn());
            }
        } else if (getOperator() instanceof Operator.LessThanOrEqualOperator) {
            if (dates) {
                return ((Date) leftValue).getTime() <= ((Date) rightValue).getTime();
            } else if (numbers) {
                return ((BigDecimal) leftValue).compareTo((BigDecimal) rightValue) <= 0;
            } else {
                throw new ValangException("<= operator only supports two date or two number values!", getLine(), getColumn());
            }
        } else if (getOperator() instanceof Operator.MoreThanOperator) {
            if (dates) {
                return ((Date) leftValue).getTime() > ((Date) rightValue).getTime();
            } else if (numbers) {
                return ((BigDecimal) leftValue).compareTo((BigDecimal) rightValue) > 0;
            } else {
                throw new ValangException("> operator only supports two date or two number values!", getLine(), getColumn());
            }
        } else if (getOperator() instanceof Operator.MoreThanOrEqualOperator) {
            if (dates) {
                return ((Date) leftValue).getTime() >= ((Date) rightValue).getTime();
            } else if (numbers) {
View Full Code Here

Examples of org.springmodules.validation.valang.ValangException

    public Object execute(Object target, FunctionCallback functionCallback) {
        try {
            return functionCallback.execute(target);
        } catch (Exception e) {
            throw new ValangException(e, line, column);
        }
    }
View Full Code Here

Examples of org.springmodules.validation.valang.ValangException

        function = resolveDefaultFunction(name, arguments, line, column);
        if (function != null) {
            return function;
        }

        throw new ValangException("Could not find function [" + name + "]", line, column);
    }
View Full Code Here

Examples of org.springmodules.validation.valang.ValangException

                    ConfigurableApplicationContext configurableApplicationContext = (ConfigurableApplicationContext) applicationContext;
                    autowireCapableBeanFactory = configurableApplicationContext.getBeanFactory();
                } else if (beanFactory instanceof AutowireCapableBeanFactory) {
                    autowireCapableBeanFactory = (AutowireCapableBeanFactory) beanFactory;
                } else if (applicationContext == null && beanFactory == null) {
                    throw new ValangException("Could not autowire function: no application context or bean factory available", line, column);
                } else {
                    throw new ValangException("Could not autowire function: application context or bean factory does not support autowiring", line, column);
                }
            }
            if (abstractFunction.isAutowireByName()) {
                autowireCapableBeanFactory.autowireBeanProperties(function, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false);
            }
            if (abstractFunction.isAutowireByType()) {
                autowireCapableBeanFactory.autowireBeanProperties(function, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false);
            }
            try {
                abstractFunction.init();
            } catch (Exception e) {
                throw new ValangException("Error initializing function", e, line, column);
            }
        }
        return function;
    }
View Full Code Here

Examples of org.springmodules.validation.valang.ValangException

    /**
     * Call this method in the constructor of custom functions to define the minimum number of arguments.
     */
    protected void definedMinNumberOfArguments(int minNumberOfArguments) {
        if (getArguments().length < minNumberOfArguments) {
            throw new ValangException("Function requires at least " + minNumberOfArguments + " argument(s)", getTemplate().getLine(), getTemplate().getColumn());
        }
    }
View Full Code Here

Examples of org.springmodules.validation.valang.ValangException

    /**
     * Call this method in the constructor of custom functions to define the maximum number of arguments.
     */
    protected void definedMaxNumberOfArguments(int maxNumberOfArguments) {
        if (getArguments().length > maxNumberOfArguments) {
            throw new ValangException("Function cannot have more than " + maxNumberOfArguments + " arguments(s)", getTemplate().getLine(), getTemplate().getColumn());
        }
    }
View Full Code Here

Examples of org.springmodules.validation.valang.ValangException

    /**
     * Call this method in the constructor of custom functions to define the exact number of arguments.
     */
    protected void definedExactNumberOfArguments(int exactNumberOfArguments) {
        if (getArguments().length != exactNumberOfArguments) {
            throw new ValangException("Function must have exactly " + exactNumberOfArguments + " arguments", getTemplate().getLine(), getTemplate().getColumn());
        }
    }
View Full Code Here

Examples of org.springmodules.validation.valang.ValangException

    /**
     * Call this method in the constructor of custom functions to define the minimum number of arguments.
     */
    protected void definedMinNumberOfArguments(int minNumberOfArguments) {
        if (getArguments().length < minNumberOfArguments) {
            throw new ValangException("Function requires at least " + minNumberOfArguments + " argument(s)", getTemplate().getLine(), getTemplate().getColumn());
        }
    }
View Full Code Here

Examples of org.springmodules.validation.valang.ValangException

    /**
     * Call this method in the constructor of custom functions to define the maximum number of arguments.
     */
    protected void definedMaxNumberOfArguments(int maxNumberOfArguments) {
        if (getArguments().length > maxNumberOfArguments) {
            throw new ValangException("Function cannot have more than " + maxNumberOfArguments + " arguments(s)", getTemplate().getLine(), getTemplate().getColumn());
        }
    }
View Full Code Here

Examples of org.springmodules.validation.valang.ValangException

    /**
     * Call this method in the constructor of custom functions to define the exact number of arguments.
     */
    protected void definedExactNumberOfArguments(int exactNumberOfArguments) {
        if (getArguments().length != exactNumberOfArguments) {
            throw new ValangException("Function must have exactly " + exactNumberOfArguments + " arguments", getTemplate().getLine(), getTemplate().getColumn());
        }
    }
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.