Example usage for org.springframework.aop.framework Advised indexOf

List of usage examples for org.springframework.aop.framework Advised indexOf

Introduction

In this page you can find the example usage for org.springframework.aop.framework Advised indexOf.

Prototype

int indexOf(Advice advice);

Source Link

Document

Return the index (from 0) of the given AOP Alliance Advice, or -1 if no such advice is an advice for this proxy.

Usage

From source file:org.openmrs.api.context.ServiceContext.java

/**
 * @param cls//  w ww .  jav  a 2 s  .  c  o  m
 * @param advisor
 */
@SuppressWarnings("unchecked")
public void addAdvisor(Class cls, Advisor advisor) {
    Advised advisedService = (Advised) services.get(cls);
    if (advisedService.indexOf(advisor) < 0) {
        advisedService.addAdvisor(advisor);
    }
    if (addedAdvisors.get(cls) == null) {
        addedAdvisors.put(cls, new HashSet<Advisor>());
    }
    getAddedAdvisors(cls).add(advisor);
}

From source file:org.openmrs.api.context.ServiceContext.java

/**
 * @param cls//from   www  .ja  v  a  2  s .  c om
 * @param advice
 */
@SuppressWarnings("unchecked")
public void addAdvice(Class cls, Advice advice) {
    Advised advisedService = (Advised) services.get(cls);
    if (advisedService.indexOf(advice) < 0) {
        advisedService.addAdvice(advice);
    }
    if (addedAdvice.get(cls) == null) {
        addedAdvice.put(cls, new HashSet<Advice>());
    }
    getAddedAdvice(cls).add(advice);
}