Package net.nelz.simplesm.exceptions

Examples of net.nelz.simplesm.exceptions.InvalidAnnotationException


        final Method[] methods = keyObject.getClass().getDeclaredMethods();
        Method targetMethod = null;
        for (final Method method : methods) {
            if (method != null && method.getAnnotation(CacheKeyMethod.class) != null) {
                if (method.getParameterTypes().length > 0) {
                    throw new InvalidAnnotationException(String.format(
                            "Method [%s] must have 0 arguments to be annotated with [%s]",
                            method.toString(),
                            CacheKeyMethod.class.getName()));
                }
                if (!String.class.equals(method.getReturnType())) {
                    throw new InvalidAnnotationException(String.format(
                            "Method [%s] must return a String to be annotated with [%s]",
                            method.toString(),
                            CacheKeyMethod.class.getName()));
                }
                if (targetMethod != null) {
                    throw new InvalidAnnotationException(String.format(
                            "Class [%s] should have only one method annotated with [%s]. See [%s] and [%s]",
                            keyObject.getClass().getName(),
                            CacheKeyMethod.class.getName(),
                            targetMethod.getName(),
                            method.getName()));
View Full Code Here


                                               final int keyIndex,
                                               final String methodDescription) throws Exception {
        if (verifyTypeIsList(keyObject.getClass())) {
            return (List<Object>) keyObject;
        }
        throw new InvalidAnnotationException(String.format(
                "The parameter object found at dataIndex [%s] is not a [%s]. " +
                "[%s] does not fulfill the requirements.",
                keyIndex,
                List.class.getName(),
                methodDescription
View Full Code Here

TOP

Related Classes of net.nelz.simplesm.exceptions.InvalidAnnotationException

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.