Android Open Source - AndroidTasks Annotations Utils






From Project

Back to project page AndroidTasks.

License

The source code is released under:

Apache License

If you think the Android project AndroidTasks listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.beyondar.android.util.annotation;
//from ww w .ja v a  2  s . co  m
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

public class AnnotationsUtils {

  /**
   * Check if the object class has the annotation in the specified method
   * 
   * @param object
   * @param methodName
   * @return true if the object class has the annotation {@link OnUiThread}
   */
  public static boolean hasUiAnnotation(Object object, String methodName) {
    return hasAnnotation(OnUiThread.class, object, methodName);
  }
  
  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;
  }
}




Java Source Code List

com.beyondar.android.util.annotation.AnnotationsUtils.java
com.beyondar.android.util.annotation.OnUiThread.java
com.beyondar.android.util.task.BaseTask.java
com.beyondar.android.util.task.BaseTimerTask.java
com.beyondar.android.util.task.OnFinishTaskListener.java
com.beyondar.android.util.task.OnFinishTask.java
com.beyondar.android.util.task.OnThreadFromPoolStop.java
com.beyondar.android.util.task.PoolThreads.java
com.beyondar.android.util.task.RunnableTask.java
com.beyondar.android.util.task.SimpleTask.java
com.beyondar.android.util.task.TaskExecutor.java
com.beyondar.android.util.task.TaskResult.java
com.beyondar.android.util.task.Task.java
com.beyondar.android.util.task.ThreadFromPool.java
com.beyondar.android.util.task.Version.java
com.beyondar.android.util.task.example.MainActivity.java
com.beyondar.android.util.task.example.TaskWithDependenciesActivity.java
com.beyondar.android.util.task.example.TaskWithUiThreadAccessActivity.java