Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

public class Main {
    public static boolean hasAnnotation(Class<? extends Annotation> annotation, Object object, String methodName) {
        try {
            Class<? extends Object> c = object.getClass();

            for (Method m : c.getMethods()) {
                if (m.getName().equals(methodName)) {
                    if (m.isAnnotationPresent(annotation)) {
                        return true;
                    }
                }
            }
        } catch (Exception e) {
        }
        return false;
    }
}