本文整理了Java中com.google.inject.internal.Annotations.isRetainedAtRuntime()
方法的一些代码示例,展示了Annotations.isRetainedAtRuntime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotations.isRetainedAtRuntime()
方法的具体详情如下:
包路径:com.google.inject.internal.Annotations
类名称:Annotations
方法名:isRetainedAtRuntime
[英]Returns true if the given annotation is retained at runtime.
[中]如果给定注释在运行时保留,则返回true。
代码示例来源:origin: com.google.inject/guice
private static void ensureRetainedAtRuntime(Class<? extends Annotation> annotationType) {
checkArgument(
Annotations.isRetainedAtRuntime(annotationType),
"%s is not retained at runtime. Please annotate it with @Retention(RUNTIME).",
annotationType.getName());
}
代码示例来源:origin: com.google.inject/guice
@Override
public Boolean visit(ScopeBinding command) {
Scope scope = checkNotNull(command.getScope(), "scope");
Class<? extends Annotation> annotationType =
checkNotNull(command.getAnnotationType(), "annotation type");
if (!Annotations.isScopeAnnotation(annotationType)) {
errors.missingScopeAnnotation(annotationType);
// Go ahead and bind anyway so we don't get collateral errors.
}
if (!Annotations.isRetainedAtRuntime(annotationType)) {
errors.missingRuntimeRetention(annotationType);
// Go ahead and bind anyway so we don't get collateral errors.
}
ScopeBinding existing = injector.state.getScopeBinding(annotationType);
if (existing != null) {
if (!scope.equals(existing.getScope())) {
errors.duplicateScopes(existing, annotationType, scope);
}
} else {
injector.state.putScopeBinding(annotationType, command);
}
return true;
}
}
代码示例来源:origin: org.sonatype.sisu/sisu-guice
private static void ensureRetainedAtRuntime(Class<? extends Annotation> annotationType) {
checkArgument(
Annotations.isRetainedAtRuntime(annotationType),
"%s is not retained at runtime. Please annotate it with @Retention(RUNTIME).",
annotationType.getName());
}
代码示例来源:origin: com.jwebmp.inject/guice
private static void ensureRetainedAtRuntime(Class<? extends Annotation> annotationType) {
checkArgument(
Annotations.isRetainedAtRuntime(annotationType),
"%s is not retained at runtime. Please annotate it with @Retention(RUNTIME).",
annotationType.getName());
}
代码示例来源:origin: org.xbib/guice
private static void ensureRetainedAtRuntime(
Class<? extends Annotation> annotationType) {
checkArgument(Annotations.isRetainedAtRuntime(annotationType),
"%s is not retained at runtime. Please annotate it with @Retention(RUNTIME).",
annotationType.getName());
}
代码示例来源:origin: com.google/inject
private static void ensureRetainedAtRuntime(
Class<? extends Annotation> annotationType) {
checkArgument(Annotations.isRetainedAtRuntime(annotationType),
"%s is not retained at runtime. Please annotate it with @Retention(RUNTIME).",
annotationType.getName());
}
代码示例来源:origin: Nextdoor/bender
private static void ensureRetainedAtRuntime(
Class<? extends Annotation> annotationType) {
checkArgument(Annotations.isRetainedAtRuntime(annotationType),
"%s is not retained at runtime. Please annotate it with @Retention(RUNTIME).",
annotationType.getName());
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.inject
private static void ensureRetainedAtRuntime(
Class<? extends Annotation> annotationType) {
checkArgument(Annotations.isRetainedAtRuntime(annotationType),
"%s is not retained at runtime. Please annotate it with @Retention(RUNTIME).",
annotationType.getName());
}
代码示例来源:origin: com.jwebmp.inject/guice
@Override
public Boolean visit(ScopeBinding command) {
Scope scope = checkNotNull(command.getScope(), "scope");
Class<? extends Annotation> annotationType =
checkNotNull(command.getAnnotationType(), "annotation type");
if (!Annotations.isScopeAnnotation(annotationType)) {
errors.missingScopeAnnotation(annotationType);
// Go ahead and bind anyway so we don't get collateral errors.
}
if (!Annotations.isRetainedAtRuntime(annotationType)) {
errors.missingRuntimeRetention(annotationType);
// Go ahead and bind anyway so we don't get collateral errors.
}
ScopeBinding existing = injector.state.getScopeBinding(annotationType);
if (existing != null) {
if (!scope.equals(existing.getScope())) {
errors.duplicateScopes(existing, annotationType, scope);
}
} else {
injector.state.putScopeBinding(annotationType, command);
}
return true;
}
}
代码示例来源:origin: org.sonatype.sisu/sisu-guice
@Override
public Boolean visit(ScopeBinding command) {
Scope scope = checkNotNull(command.getScope(), "scope");
Class<? extends Annotation> annotationType =
checkNotNull(command.getAnnotationType(), "annotation type");
if (!Annotations.isScopeAnnotation(annotationType)) {
errors.missingScopeAnnotation(annotationType);
// Go ahead and bind anyway so we don't get collateral errors.
}
if (!Annotations.isRetainedAtRuntime(annotationType)) {
errors.missingRuntimeRetention(annotationType);
// Go ahead and bind anyway so we don't get collateral errors.
}
ScopeBinding existing = injector.state.getScopeBinding(annotationType);
if (existing != null) {
if (!scope.equals(existing.getScope())) {
errors.duplicateScopes(existing, annotationType, scope);
}
} else {
injector.state.putScopeBinding(annotationType, command);
}
return true;
}
}
代码示例来源:origin: org.xbib/guice
@Override
public Boolean visit(ScopeBinding command) {
Scope scope = checkNotNull(command.getScope(), "scope");
Class<? extends Annotation> annotationType = checkNotNull(command.getAnnotationType(), "annotation type");
if (!Annotations.isScopeAnnotation(annotationType)) {
errors.missingScopeAnnotation(annotationType);
// Go ahead and bind anyway so we don't get collateral errors.
}
if (!Annotations.isRetainedAtRuntime(annotationType)) {
errors.missingRuntimeRetention(annotationType);
// Go ahead and bind anyway so we don't get collateral errors.
}
ScopeBinding existing = injector.state.getScopeBinding(annotationType);
if (existing != null) {
if (!scope.equals(existing.getScope())) {
errors.duplicateScopes(existing, annotationType, scope);
}
} else {
injector.state.putScopeBinding(annotationType, command);
}
return true;
}
}
代码示例来源:origin: com.google/inject
@Override public Boolean visit(ScopeBinding command) {
Scope scope = command.getScope();
Class<? extends Annotation> annotationType = command.getAnnotationType();
if (!Annotations.isScopeAnnotation(annotationType)) {
errors.withSource(annotationType).missingScopeAnnotation();
// Go ahead and bind anyway so we don't get collateral errors.
}
if (!Annotations.isRetainedAtRuntime(annotationType)) {
errors.withSource(annotationType)
.missingRuntimeRetention(command.getSource());
// Go ahead and bind anyway so we don't get collateral errors.
}
Scope existing = injector.state.getScope(checkNotNull(annotationType, "annotation type"));
if (existing != null) {
errors.duplicateScopes(existing, annotationType, scope);
} else {
injector.state.putAnnotation(annotationType, checkNotNull(scope, "scope"));
}
return true;
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.inject
@Override public Boolean visit(ScopeBinding command) {
Scope scope = command.getScope();
Class<? extends Annotation> annotationType = command.getAnnotationType();
if (!Annotations.isScopeAnnotation(annotationType)) {
errors.withSource(annotationType).missingScopeAnnotation();
// Go ahead and bind anyway so we don't get collateral errors.
}
if (!Annotations.isRetainedAtRuntime(annotationType)) {
errors.withSource(annotationType)
.missingRuntimeRetention(command.getSource());
// Go ahead and bind anyway so we don't get collateral errors.
}
Scope existing = injector.state.getScope(checkNotNull(annotationType, "annotation type"));
if (existing != null) {
errors.duplicateScopes(existing, annotationType, scope);
} else {
injector.state.putAnnotation(annotationType, checkNotNull(scope, "scope"));
}
return true;
}
}
代码示例来源:origin: Nextdoor/bender
@Override public Boolean visit(ScopeBinding command) {
Scope scope = command.getScope();
Class<? extends Annotation> annotationType = command.getAnnotationType();
if (!Annotations.isScopeAnnotation(annotationType)) {
errors.withSource(annotationType).missingScopeAnnotation();
// Go ahead and bind anyway so we don't get collateral errors.
}
if (!Annotations.isRetainedAtRuntime(annotationType)) {
errors.withSource(annotationType)
.missingRuntimeRetention(command.getSource());
// Go ahead and bind anyway so we don't get collateral errors.
}
Scope existing = injector.state.getScope(checkNotNull(annotationType, "annotation type"));
if (existing != null) {
errors.duplicateScopes(existing, annotationType, scope);
} else {
injector.state.putAnnotation(annotationType, checkNotNull(scope, "scope"));
}
return true;
}
}
内容来源于网络,如有侵权,请联系作者删除!