Package org.constretto.exception

Examples of org.constretto.exception.ConstrettoException


        Class<?> configurationClass;
        try {
            configurationClass = Class.forName(className);
        } catch (ClassNotFoundException e) {
            throw new ConstrettoException(String.format("Could not load configuration class \"%s\"", className), e);
        }
        final List<Method> methods = findStaticNonArgsMethodsReturningConstrettoConfiguration(configurationClass);
        if (methods.isEmpty()) {
            throw new ConstrettoException("Could not find a static factory non-arg method that creates a " +
                    "org.constretto.ConstrettoConfiguration instance in your configuration class (or superclass). " +
                    "In order to use automatic setup of Constretto-Spring BeanPostProcessors " +
                    "you will have to define one");
        } else if (methods.size() > 1) {
            throw new ConstrettoException("Found more than static non-arg method returning a " +
                    "org.constretto.ConstrettoConfiguration instance in your configuration class (or superclass). " +
                    "To use automatic setup of Constretto Spring BeanPostProcessors you should have only one");
        } else {
            Method factoryMethod = methods.get(0);
            try {
                return (ConstrettoConfiguration) factoryMethod.invoke(null);
            } catch (IllegalAccessException e) {
                throw new ConstrettoException(String.format("Could not invoke factory method \"%1$s\" in configuration class \"%2$s\"", factoryMethod.getName(), configurationClass.getName()), e);
            } catch (InvocationTargetException e) {
                throw new ConstrettoException(String.format("Could not invoke factory method \"%1$s\" in configuration class \"%2$s\"", factoryMethod.getName(), configurationClass.getName()), e);
            }
        }
    }
View Full Code Here


            } else {
                List<String> equalPriorityBeans = new ArrayList<String>();
                for (BeanDefinition highestPriorityBean : highestPriorityBeans) {
                    equalPriorityBeans.add(highestPriorityBean.getBeanClassName());
                }
                throw new ConstrettoException(
                        "More than one bean with the class or interface + [" + lookupClass.getSimpleName() +"] registered with same tag. Could not resolve priority. To fix this, remove one of the following beans "
                                + equalPriorityBeans.toString());
            }
        }
    }
View Full Code Here

        return autowireCandidate;
    }

    private void validateAnnotationValues(String beanName, List<String> beanEnvironments) {
        if (beanEnvironments.isEmpty()) {
            throw new ConstrettoException(
                    "You must specify environment tags in @Environment. offending bean: "
                            + beanName);
        }
    }
View Full Code Here

                beanClass);
        if (constructorsWithConfigureAnnotation == null) {
            return null;
        } else {
            if (constructorsWithConfigureAnnotation.length > 1) {
                throw new ConstrettoException("You should only have one constructor annotated with @Configure");
            }
            return constructorsWithConfigureAnnotation[0];
        }
    }
View Full Code Here

TOP

Related Classes of org.constretto.exception.ConstrettoException

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.