类com.google.inject.ScopeAnnotation源码实例Demo

下面列出了怎么用com.google.inject.ScopeAnnotation的API类实例代码及写法,或者点击链接到github查看源代码。

/**
 * Checks scope annotation presence directly on bean. Base classes are not checked as scope is not
 * inheritable.
 *
 * @param type      bean type
 * @param hkManaged true if bean is going to be managed by hk, false for guice management
 * @return true if scope annotation found, false otherwise
 */
private boolean hasScopeAnnotation(final Class<?> type, final boolean hkManaged) {
    boolean found = false;
    for (Annotation ann : type.getAnnotations()) {
        final Class<? extends Annotation> annType = ann.annotationType();
        if (annType.isAnnotationPresent(Scope.class)) {
            found = true;
            break;
        }
        // guice has special marker annotation
        if (!hkManaged && annType.isAnnotationPresent(ScopeAnnotation.class)) {
            found = true;
            break;
        }
    }
    return found;
}
 
源代码2 项目: n4js   文件: ScopeManager.java
/**
 * Tells if the given annotation is a Google Guice "scope annotation", i.e. if the annotation class is itself
 * annotated with <code>@ScopeAnnotation</code>.
 */
public static final boolean isScopeAnnotation(Class<? extends Annotation> annotationClass) {
	return annotationClass.isAnnotationPresent(ScopeAnnotation.class);
}
 
 类所在包
 类方法
 同包方法