Java 类org.aspectj.lang.annotation.DeclareParents 实例源码

项目:lams    文件:ReflectiveAspectJAdvisorFactory.java   
/**
 * Build a {@link org.springframework.aop.aspectj.DeclareParentsAdvisor}
 * for the given introduction field.
 * <p>Resulting Advisors will need to be evaluated for targets.
 * @param introductionField the field to introspect
 * @return {@code null} if not an Advisor
 */
private Advisor getDeclareParentsAdvisor(Field introductionField) {
    DeclareParents declareParents = introductionField.getAnnotation(DeclareParents.class);
    if (declareParents == null) {
        // Not an introduction field
        return null;
    }

    if (DeclareParents.class.equals(declareParents.defaultImpl())) {
        // This is what comes back if it wasn't set. This seems bizarre...
        // TODO this restriction possibly should be relaxed
        throw new IllegalStateException("defaultImpl must be set on DeclareParents");
    }

    return new DeclareParentsAdvisor(
            introductionField.getType(), declareParents.value(), declareParents.defaultImpl());
}
项目:spring4-understanding    文件:ReflectiveAspectJAdvisorFactory.java   
/**
 * Build a {@link org.springframework.aop.aspectj.DeclareParentsAdvisor}
 * for the given introduction field.
 * <p>Resulting Advisors will need to be evaluated for targets.
 * @param introductionField the field to introspect
 * @return {@code null} if not an Advisor
 */
private Advisor getDeclareParentsAdvisor(Field introductionField) {
    DeclareParents declareParents = introductionField.getAnnotation(DeclareParents.class);
    if (declareParents == null) {
        // Not an introduction field
        return null;
    }

    if (DeclareParents.class == declareParents.defaultImpl()) {
        // This is what comes back if it wasn't set. This seems bizarre...
        // TODO this restriction possibly should be relaxed
        throw new IllegalStateException("defaultImpl must be set on DeclareParents");
    }

    return new DeclareParentsAdvisor(
            introductionField.getType(), declareParents.value(), declareParents.defaultImpl());
}
项目:spring    文件:ReflectiveAspectJAdvisorFactory.java   
/**
 * Build a {@link org.springframework.aop.aspectj.DeclareParentsAdvisor}
 * for the given introduction field.
 * <p>Resulting Advisors will need to be evaluated for targets.
 * @param introductionField the field to introspect
 * @return {@code null} if not an Advisor
 */
private Advisor getDeclareParentsAdvisor(Field introductionField) {
    DeclareParents declareParents = introductionField.getAnnotation(DeclareParents.class);
    if (declareParents == null) {
        // Not an introduction field
        return null;
    }

    if (DeclareParents.class == declareParents.defaultImpl()) {
        // This is what comes back if it wasn't set. This seems bizarre...
        // TODO this restriction possibly should be relaxed
        throw new IllegalStateException("defaultImpl must be set on DeclareParents");
    }

    return new DeclareParentsAdvisor(
            introductionField.getType(), declareParents.value(), declareParents.defaultImpl());
}
项目:class-guard    文件:ReflectiveAspectJAdvisorFactory.java   
/**
 * Build a {@link org.springframework.aop.aspectj.DeclareParentsAdvisor}
 * for the given introduction field.
 * <p>Resulting Advisors will need to be evaluated for targets.
 * @param introductionField the field to introspect
 * @return {@code null} if not an Advisor
 */
private Advisor getDeclareParentsAdvisor(Field introductionField) {
    DeclareParents declareParents = introductionField.getAnnotation(DeclareParents.class);
    if (declareParents == null) {
        // Not an introduction field
        return null;
    }

    if (DeclareParents.class.equals(declareParents.defaultImpl())) {
        // This is what comes back if it wasn't set. This seems bizarre...
        // TODO this restriction possibly should be relaxed
        throw new IllegalStateException("defaultImpl must be set on DeclareParents");
    }

    return new DeclareParentsAdvisor(
            introductionField.getType(), declareParents.value(), declareParents.defaultImpl());
}