本文整理了Java中org.eclipse.jdt.core.dom.Annotation.getTypeName()
方法的一些代码示例,展示了Annotation.getTypeName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotation.getTypeName()
方法的具体详情如下:
包路径:org.eclipse.jdt.core.dom.Annotation
类名称:Annotation
方法名:getTypeName
[英]Returns the annotation type name of this annotation.
[中]返回此批注的批注类型名称。
代码示例来源:origin: org.jboss.forge/roaster-jdt
@Override
public String getName()
{
return annotation.getTypeName().getFullyQualifiedName();
}
代码示例来源:origin: aserg-ufmg/RefDiff
private static Set<String> extractAnnotationTypes(List<?> modifiers) {
Set<String> annotations = new HashSet<String>();
for (Object modifier : modifiers) {
if (modifier instanceof Annotation) {
Annotation a = (Annotation) modifier;
annotations.add(a.getTypeName().toString());
}
}
return annotations;
}
代码示例来源:origin: forge/roaster
@Override
public String getName()
{
return annotation.getTypeName().getFullyQualifiedName();
}
代码示例来源:origin: mauricioaniche/springlint
private void addAnnotation(Annotation o) {
if(deep>1) return;
String annotation = o.getTypeName().toString();
allAnnotations.add(annotation);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core.manipulation
public static Annotation findAnnotation(String qualifiedTypeName, List<IExtendedModifier> modifiers) {
for (int i= 0; i < modifiers.size(); i++) {
IExtendedModifier curr= modifiers.get(i);
if (curr instanceof Annotation) {
Annotation annot= (Annotation) curr;
ITypeBinding binding= annot.getTypeName().resolveTypeBinding();
if (binding != null && qualifiedTypeName.equals(binding.getQualifiedName())) {
return annot;
}
}
}
return null;
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
private static Annotation findAnnotation(String qualifiedTypeName, List modifiers) {
for (int i= 0; i < modifiers.size(); i++) {
Object curr= modifiers.get(i);
if (curr instanceof Annotation) {
Annotation annot= (Annotation) curr;
ITypeBinding binding= annot.getTypeName().resolveTypeBinding();
if (binding != null && qualifiedTypeName.equals(binding.getQualifiedName())) {
return annot;
}
}
}
return null;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
public static Annotation findAnnotation(String qualifiedTypeName, List<IExtendedModifier> modifiers) {
for (int i= 0; i < modifiers.size(); i++) {
IExtendedModifier curr= modifiers.get(i);
if (curr instanceof Annotation) {
Annotation annot= (Annotation) curr;
ITypeBinding binding= annot.getTypeName().resolveTypeBinding();
if (binding != null && qualifiedTypeName.equals(binding.getQualifiedName())) {
return annot;
}
}
}
return null;
}
}
代码示例来源:origin: cbeust/testng-eclipse
private Annotation getAnnotation(List<IExtendedModifier> modifiers, String annotation) {
for (IExtendedModifier m : modifiers) {
if (m.isAnnotation()) {
Annotation a = (Annotation) m;
if (annotation.equals(a.getTypeName().toString())) {
return a;
}
}
}
return null;
}
代码示例来源:origin: sorra/Exia
public static boolean isFieldInjectable(FieldDeclaration fd, String annoClassSimpleName) {
for (Object modifier : fd.modifiers()) {
if (modifier instanceof Annotation) {
Annotation annotation = (Annotation) modifier;
String annoTypeName = annotation.getTypeName().getFullyQualifiedName();
if (annoTypeName.equals(annoClassSimpleName)) {
return true;
} else if (annoTypeName.contains(annoClassSimpleName)) {
logger.log("Strange annotation type: " + annoTypeName);
}
}
}
return false;
}
代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.codegen
/**
* Returns name of annotation type with preceding @ sign.
* @see org.eclipse.emf.codegen.merge.java.facade.JNode#getName()
*/
public String getName()
{
if (name == UNITIALIZED_STRING)
{
// adding 'at' allows distinguish annotations from other members
// (i.e. inner class verses annotation of a class)
//
name = "@" + ASTFacadeHelper.toString(getASTNode().getTypeName());
}
return name;
}
代码示例来源:origin: org.eclipse/org.eclipse.emf.codegen
/**
* Returns name of annotation type with preceding @ sign.
* @see org.eclipse.emf.codegen.merge.java.facade.JNode#getName()
*/
public String getName()
{
if (name == UNITIALIZED_STRING)
{
// adding 'at' allows distinguish annotations from other members
// (i.e. inner class verses annotation of a class)
//
name = "@" + ASTFacadeHelper.toString(getASTNode().getTypeName());
}
return name;
}
代码示例来源:origin: mast-group/tassal
public static boolean hasOverrideAnnotation(final MethodDeclaration node) {
final List modifiers = node.modifiers();
for (final Object mod : modifiers) {
final IExtendedModifier modifier = (IExtendedModifier) mod;
if (modifier.isAnnotation()) {
final Annotation annotation = (Annotation) modifier;
if (annotation.getTypeName().toString().equals("Override")) {
return true;
}
}
}
return false;
}
代码示例来源:origin: org.eclipse.xtend/org.eclipse.xtend.core
public boolean isOverrideMethod(final MethodDeclaration declaration) {
final Function1<Annotation, Boolean> _function = (Annotation it) -> {
String _string = it.getTypeName().toString();
return Boolean.valueOf(Objects.equal("Override", _string));
};
boolean _exists = IterableExtensions.<Annotation>exists(Iterables.<Annotation>filter(declaration.modifiers(), Annotation.class), _function);
if (_exists) {
return true;
}
final IMethodBinding iMethodBinding = declaration.resolveBinding();
if ((iMethodBinding != null)) {
IMethodBinding _findOverride = this.findOverride(iMethodBinding, iMethodBinding.getDeclaringClass());
return (_findOverride != null);
}
return false;
}
代码示例来源:origin: usethesource/rascal
public void preVisit(ASTNode node) {
if (node instanceof Annotation) {
insert(annotations, getParent(), resolveBinding(((Annotation) node).getTypeName()));
return;
}
ownValue = resolveBinding(node);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
private boolean hasNullAnnotation(MethodDeclaration decl) {
List<IExtendedModifier> modifiers= decl.modifiers();
String nonnull= NullAnnotationsFix.getNonNullAnnotationName(decl.resolveBinding().getJavaElement(), false);
String nullable= NullAnnotationsFix.getNullableAnnotationName(decl.resolveBinding().getJavaElement(), false);
for (Object mod : modifiers) {
if (mod instanceof Annotation) {
Name annotationName= ((Annotation) mod).getTypeName();
String fullyQualifiedName= annotationName.getFullyQualifiedName();
if (annotationName.isSimpleName() ? nonnull.endsWith(fullyQualifiedName) : fullyQualifiedName.equals(nonnull))
return true;
if (annotationName.isSimpleName() ? nullable.endsWith(fullyQualifiedName) : fullyQualifiedName.equals(nullable))
return true;
}
}
return false;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
private static boolean hasNullAnnotation(MethodDeclaration decl) {
List<IExtendedModifier> modifiers= decl.modifiers();
String nonnull= NullAnnotationsFix.getNonNullAnnotationName(decl.resolveBinding().getJavaElement(), false);
String nullable= NullAnnotationsFix.getNullableAnnotationName(decl.resolveBinding().getJavaElement(), false);
for (Object mod : modifiers) {
if (mod instanceof Annotation) {
Name annotationName= ((Annotation) mod).getTypeName();
String fullyQualifiedName= annotationName.getFullyQualifiedName();
if (annotationName.isSimpleName() ? nonnull.endsWith(fullyQualifiedName) : fullyQualifiedName.equals(nonnull))
return true;
if (annotationName.isSimpleName() ? nullable.endsWith(fullyQualifiedName) : fullyQualifiedName.equals(nullable))
return true;
}
}
return false;
}
代码示例来源:origin: org.eclipse.xtend/org.eclipse.xtend.core
public void appendModifiers(final ASTNode node, final Iterable<IExtendedModifier> ext, final Function1<? super ASTNode, ? extends StringBuffer> callBack) {
final Procedure1<IExtendedModifier> _function = (IExtendedModifier p) -> {
((ASTNode) p).accept(this);
};
final Procedure1<IExtendedModifier> appender = _function;
final Function1<IExtendedModifier, Boolean> _function_1 = (IExtendedModifier it) -> {
return Boolean.valueOf((it.isAnnotation() && (!Objects.equal(((Annotation) it).getTypeName().toString(), "Override"))));
};
IterableExtensions.<IExtendedModifier>forEach(IterableExtensions.<IExtendedModifier>filter(ext, _function_1), appender);
if ((callBack != null)) {
callBack.apply(node);
}
final Function1<IExtendedModifier, Boolean> _function_2 = (IExtendedModifier it) -> {
return Boolean.valueOf((it.isModifier() && (!Objects.equal(((Modifier) it).getKeyword().toString(), "default"))));
};
IterableExtensions.<IExtendedModifier>forEach(IterableExtensions.<IExtendedModifier>filter(ext, _function_2), appender);
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
protected ASTRewrite getRewrite() throws CoreException {
AST ast= fAnnotation.getAST();
ASTRewrite rewrite= ASTRewrite.create(ast);
createImportRewrite((CompilationUnit) fAnnotation.getRoot());
ListRewrite listRewrite;
if (fAnnotation instanceof NormalAnnotation) {
listRewrite= rewrite.getListRewrite(fAnnotation, NormalAnnotation.VALUES_PROPERTY);
} else {
NormalAnnotation newAnnotation= ast.newNormalAnnotation();
newAnnotation.setTypeName((Name) rewrite.createMoveTarget(fAnnotation.getTypeName()));
rewrite.replace(fAnnotation, newAnnotation, null);
listRewrite= rewrite.getListRewrite(newAnnotation, NormalAnnotation.VALUES_PROPERTY);
}
addMissingAtributes(fAnnotation.resolveTypeBinding(), listRewrite);
return rewrite;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
@Override
protected ASTRewrite getRewrite() throws CoreException {
AST ast= fAnnotation.getAST();
ASTRewrite rewrite= ASTRewrite.create(ast);
createImportRewrite((CompilationUnit) fAnnotation.getRoot());
ListRewrite listRewrite;
if (fAnnotation instanceof NormalAnnotation) {
listRewrite= rewrite.getListRewrite(fAnnotation, NormalAnnotation.VALUES_PROPERTY);
} else {
NormalAnnotation newAnnotation= ast.newNormalAnnotation();
newAnnotation.setTypeName((Name) rewrite.createMoveTarget(fAnnotation.getTypeName()));
rewrite.replace(fAnnotation, newAnnotation, null);
listRewrite= rewrite.getListRewrite(newAnnotation, NormalAnnotation.VALUES_PROPERTY);
}
addMissingAtributes(fAnnotation.resolveTypeBinding(), listRewrite);
return rewrite;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
@Override
protected ASTRewrite getRewrite() throws CoreException {
AST ast= fAnnotation.getAST();
ASTRewrite rewrite= ASTRewrite.create(ast);
createImportRewrite((CompilationUnit) fAnnotation.getRoot());
ListRewrite listRewrite;
if (fAnnotation instanceof NormalAnnotation) {
listRewrite= rewrite.getListRewrite(fAnnotation, NormalAnnotation.VALUES_PROPERTY);
} else {
NormalAnnotation newAnnotation= ast.newNormalAnnotation();
newAnnotation.setTypeName((Name) rewrite.createMoveTarget(fAnnotation.getTypeName()));
rewrite.replace(fAnnotation, newAnnotation, null);
listRewrite= rewrite.getListRewrite(newAnnotation, NormalAnnotation.VALUES_PROPERTY);
}
addMissingAtributes(fAnnotation.resolveTypeBinding(), listRewrite);
return rewrite;
}
内容来源于网络,如有侵权,请联系作者删除!