All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.yoojia.events.AnnotatedFinder Maven / Gradle / Ivy

There is a newer version: 1.1
Show newest version
package com.github.yoojia.events;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

/**
 * @author YOOJIA.CHEN ([email protected])
 * @version 2015-09-09
 */
class AnnotatedFinder {

    private final Object object;

    public AnnotatedFinder(Object object) {
        this.object = object;
    }

    public List find() {
        final List array = new ArrayList<>();
        final Class type = object.getClass();
        final Method[] methods = type.getDeclaredMethods();
        for (Method method : methods) {
            final Subscribe subscribe = method.getAnnotation(Subscribe.class);
            if (subscribe == null) {
                continue;
            }
            array.add(new SubscribeMeta(object, method));
        }
        return array;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy