Package org.apache.commons.digester.annotations

Examples of org.apache.commons.digester.annotations.DigesterLoadingException


     */
    public void handle(Annotation annotation, Method element, FromAnnotationsRuleSet ruleSet) {
        if (SUPPORTED_ARGS != element.getParameterTypes().length) {
            DigesterRule rule = annotation.annotationType().getAnnotation(DigesterRule.class);

            throw new DigesterLoadingException("Methods annotated with digester annotation rule @"
                    + rule.reflectsRule().getName()
                    + " must have just one argument");
        }

        Object explicitTypesObject = AnnotationUtils.getAnnotationValue(annotation);
        if (explicitTypesObject == null
                || !explicitTypesObject.getClass().isArray()
                || Class.class != explicitTypesObject.getClass().getComponentType()) {
            throw new DigesterLoadingException("Impossible to apply this handler, @"
                    + annotation.getClass().getName()
                    + ".value() has to be of type 'Class<?>[]'");
        }

        Class<?>[] explicitTypes = (Class<?>[]) explicitTypesObject;
        Class<?> paramType = element.getParameterTypes()[0];

        if (explicitTypes.length > 0) {
            for (Class<?> explicitType : explicitTypes) {
                if (!paramType.isAssignableFrom(explicitType)) {
                    throw new DigesterLoadingException("Impossible to handle annotation "
                            + annotation
                            + " on method "
                            + element.toGenericString()
                            + ", "
                            + explicitType.getName()
View Full Code Here


    }

    private void doHandle(Annotation methodAnnotation, Method method, Class<?> type, FromAnnotationsRuleSet ruleSet) {
        if (type.isInterface()
                && Modifier.isAbstract(type.getModifiers())) {
            throw new DigesterLoadingException("Impossible to proceed analyzing "
                    + methodAnnotation
                    + ", specified type '"
                    + type.getName()
                    + "' is an interface/abstract");
        }
View Full Code Here

    public <T extends AnnotationRuleProvider<? extends Annotation, ? extends AnnotatedElement, ? extends Rule>>
            T newInstance(Class<T> type) throws DigesterLoadingException {
        try {
            return type.newInstance();
        } catch (Exception e) {
            throw new DigesterLoadingException("An error occurred while creating '"
                    + type
                    + "' instance", e);
        }
    }
View Full Code Here

    public <L extends DigesterLoaderHandler<? extends Annotation, ? extends AnnotatedElement>> L newInstance(
            Class<L> type) throws DigesterLoadingException {
        try {
            return type.newInstance();
        } catch (Exception e) {
            throw new DigesterLoadingException("An error occurred while creating '"
                    + type
                    + "' instance", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.digester.annotations.DigesterLoadingException

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.