Package com.googlecode.jsonplugin.annotations

Examples of com.googlecode.jsonplugin.annotations.SMDMethod


        //get public methods
        Method[] methods = JSONUtil.listSMDMethods(clazz, ignoreInterfaces);

        for (Method method : methods) {
            SMDMethod smdMethodAnnotation = method.getAnnotation(SMDMethod.class);

            //SMDMethod annotation is required
            if (((smdMethodAnnotation != null) && !this.shouldExcludeProperty(method
                    .getName()))) {
                String methodName = smdMethodAnnotation.name().length() == 0 ? method
                        .getName() : smdMethodAnnotation.name();

                com.googlecode.jsonplugin.smd.SMDMethod smdMethod = new com.googlecode.jsonplugin.smd.SMDMethod(
                        methodName);
                smd.addSMDMethod(smdMethod);
View Full Code Here


    @SuppressWarnings("unchecked")
    public static Method[] listSMDMethods(Class clazz, boolean ignoreInterfaces) {
        final List<Method> methods = new LinkedList<Method>();
        if (ignoreInterfaces) {
            for (Method method : clazz.getMethods()) {
                SMDMethod smdMethodAnnotation = method.getAnnotation(SMDMethod.class);
                if (smdMethodAnnotation != null) {
                    methods.add(method);
                }
            }
        } else {
            // recurse the entire superclass/interface hierarchy and add in order encountered
            JSONUtil.visitInterfaces(clazz, new JSONUtil.ClassVisitor() {
                public boolean visit(Class aClass) {
                    for (Method method : aClass.getMethods()) {
                        SMDMethod smdMethodAnnotation = method
                                .getAnnotation(SMDMethod.class);
                        if (smdMethodAnnotation != null &&
                                !methods.contains(method)) {
                            methods.add(method);
                        }
View Full Code Here

     *
     * @return true if matches name and parameterCount
     */
    private boolean checkSMDMethodSignature(Method method, String name, int parameterCount) {

        SMDMethod smdMethodAnntotation = method.getAnnotation(SMDMethod.class);
        if (smdMethodAnntotation != null) {
            String alias = smdMethodAnntotation.name();
            boolean paramsMatch = method.getParameterTypes().length == parameterCount;
            if ((alias.length() == 0 && method.getName().equals(name) && paramsMatch) ||
                    (alias.equals(name) && paramsMatch)) {
                return true;
            }
View Full Code Here

TOP

Related Classes of com.googlecode.jsonplugin.annotations.SMDMethod

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.