本文整理了Java中org.eclipse.jdt.core.dom.Annotation.isMarkerAnnotation()
方法的一些代码示例,展示了Annotation.isMarkerAnnotation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotation.isMarkerAnnotation()
方法的具体详情如下:
包路径:org.eclipse.jdt.core.dom.Annotation
类名称:Annotation
方法名:isMarkerAnnotation
[英]Returns whether this is a marker annotation ( MarkerAnnotation).
[中]返回这是否是标记注释(标记符号)。
代码示例来源:origin: forge/roaster
@Override
public boolean isMarker()
{
return annotation.isMarkerAnnotation();
}
代码示例来源:origin: org.jboss.forge/roaster-jdt
@Override
public boolean isMarker()
{
return annotation.isMarkerAnnotation();
}
代码示例来源:origin: org.eclipse/org.eclipse.jpt.core
/**
* Remove the *first* annotation element with the specified name
* from the specified annotation, converting the annotation as appropriate.
*/
protected void removeElementAndNormalize(ModifiedDeclaration declaration, Annotation outer) {
if (outer.isNormalAnnotation()) {
this.removeElementAndNormalize(declaration, (NormalAnnotation) outer);
} else if (outer.isSingleMemberAnnotation()) {
this.removeElementAndNormalize(declaration, (SingleMemberAnnotation) outer);
} else if (outer.isMarkerAnnotation()) {
this.removeElementAndNormalize(declaration, (MarkerAnnotation) outer);
} else {
throw new IllegalArgumentException("unknown annotation type: " + outer);
}
}
代码示例来源:origin: org.eclipse/org.eclipse.jpt.core
protected void removeElement(Annotation annotation, ModifiedDeclaration declaration) {
if (annotation == null) {
this.removeElementNoAnnotation(declaration);
}
else if (annotation.isMarkerAnnotation()) {
this.removeElementMarkerAnnotation((MarkerAnnotation) annotation, declaration);
}
else if (annotation.isSingleMemberAnnotation()) {
this.removeElementSingleMemberAnnotation((SingleMemberAnnotation) annotation, declaration);
}
else if (annotation.isNormalAnnotation()) {
this.removeElementNormalAnnotation((NormalAnnotation) annotation, declaration);
}
else {
throw new IllegalArgumentException("unknown annotation type: " + annotation);
}
}
代码示例来源:origin: org.eclipse/org.eclipse.jpt.core
/**
* Return the expression value of the *first* annotation element
* with the adapter's element name.
* Return null if the annotation has no such element.
* (An element name of "value" will return the value of a single
* member annotation.)
*/
protected E expression(Annotation annotation) {
if (annotation == null) {
return this.expressionNoAnnotation();
}
if (annotation.isMarkerAnnotation()) {
return this.expressionMarkerAnnotation((MarkerAnnotation) annotation);
}
if (annotation.isSingleMemberAnnotation()) {
return this.expressionSingleMemberAnnotation((SingleMemberAnnotation) annotation);
}
if (annotation.isNormalAnnotation()) {
return this.expressionNormalAnnotation((NormalAnnotation) annotation);
}
throw new IllegalArgumentException("unknown annotation type: " + annotation);
}
代码示例来源:origin: org.eclipse/org.eclipse.jpt.core
@Override
protected void addAnnotation(ModifiedDeclaration declaration, Annotation inner) {
Annotation outer = this.outerAnnotationAdapter.getAnnotation(declaration);
if (outer == null) {
this.buildNewOuterAnnotation(declaration, inner);
} else if (outer.isMarkerAnnotation()) {
this.modifyAnnotation(declaration, (MarkerAnnotation) outer, inner);
} else if (outer.isSingleMemberAnnotation()) {
this.modifyAnnotation(declaration, (SingleMemberAnnotation) outer, inner);
} else if (outer.isNormalAnnotation()) {
this.modifyAnnotation(declaration, (NormalAnnotation) outer, inner);
} else {
throw new IllegalStateException("unknown annotation type: " + outer);
}
}
代码示例来源:origin: org.eclipse/org.eclipse.jpt.core
/**
* set non-null, non-empty value
*/
protected void setValue(Expression value, Annotation annotation, ModifiedDeclaration declaration) {
if (value == null) {
this.removeElement(annotation, declaration);
}
else if (annotation == null) {
this.setValueNoAnnotation(value, declaration);
}
else if (annotation.isMarkerAnnotation()) {
this.setValueMarkerAnnotation(value, (MarkerAnnotation) annotation, declaration);
}
else if (annotation.isSingleMemberAnnotation()) {
this.setValueSingleMemberAnnotation(value, (SingleMemberAnnotation) annotation, declaration);
}
else if (annotation.isNormalAnnotation()) {
this.setValueNormalAnnotation(value, (NormalAnnotation) annotation, declaration);
}
else {
throw new IllegalArgumentException("unknown annotation type: " + annotation);
}
}
代码示例来源:origin: ModeShape/modeshape
annotationNode.setProperty(ClassFileSequencerLexicon.NAME, name);
if (annotation.isMarkerAnnotation()) {
annotationNode.setProperty(ClassFileSequencerLexicon.ANNOTATION_TYPE,
ClassFileSequencerLexicon.AnnotationType.MARKER.toString());
代码示例来源:origin: org.modeshape/modeshape-sequencer-java
annotationNode.setProperty(ClassFileSequencerLexicon.NAME, name);
if (annotation.isMarkerAnnotation()) {
annotationNode.setProperty(ClassFileSequencerLexicon.ANNOTATION_TYPE,
ClassFileSequencerLexicon.AnnotationType.MARKER.toString());
代码示例来源:origin: org.eclipse/org.eclipse.jpt.core
return false;
if (containerAnnotation.isMarkerAnnotation()) {
return false;
代码示例来源:origin: org.eclipse/org.eclipse.jpt.core
/**
* move the annotation in the container annotation at index=0
* to the stand-alone annotation
*/
private void convertLastElementAnnotationToStandAloneAnnotation(ModifiedDeclaration declaration) {
Annotation last = this.zeroNestedAnnotationAdapter.getAnnotation(declaration);
if (last == null) {
throw new IllegalStateException("the last nested annotation is missing");
} else if (last.isMarkerAnnotation()) {
this.newStandAloneMarkerAnnotation(declaration);
} else if (last.isSingleMemberAnnotation()) {
Expression vv = ((SingleMemberAnnotation) last).getValue();
vv = (Expression) ASTNode.copySubtree(vv.getAST(), vv);
this.newStandAloneSingleMemberAnnotation(declaration).setValue(vv);
} else if (last.isNormalAnnotation()) {
NormalAnnotation newNA = this.newStandAloneNormalAnnotation(declaration);
List<MemberValuePair> values = this.values(newNA);
for (MemberValuePair pair : this.values((NormalAnnotation) last)) {
values.add((MemberValuePair) ASTNode.copySubtree(pair.getAST(), pair));
}
} else {
throw new IllegalStateException("unknown annotation type: " + last);
}
this.zeroNestedAnnotationAdapter.removeAnnotation(declaration);
}
代码示例来源:origin: org.eclipse/org.eclipse.jpt.core
/**
* move the specified, non-null, stand-alone annotation to
* the container annotation at index=0
*/
private void moveStandAloneAnnotationToContainerAnnotation(Annotation standAloneAnnotation, ModifiedDeclaration declaration) {
if (standAloneAnnotation.isMarkerAnnotation()) {
this.zeroNestedAnnotationAdapter.newMarkerAnnotation(declaration);
} else if (standAloneAnnotation.isSingleMemberAnnotation()) {
Expression vv = ((SingleMemberAnnotation) standAloneAnnotation).getValue();
vv = (Expression) ASTNode.copySubtree(vv.getAST(), vv);
this.zeroNestedAnnotationAdapter.newSingleMemberAnnotation(declaration).setValue(vv);
} else if (standAloneAnnotation.isNormalAnnotation()) {
NormalAnnotation newNA = this.zeroNestedAnnotationAdapter.newNormalAnnotation(declaration);
List<MemberValuePair> values = this.values(newNA);
for (MemberValuePair pair : this.values((NormalAnnotation) standAloneAnnotation)) {
values.add((MemberValuePair) ASTNode.copySubtree(pair.getAST(), pair));
}
} else {
throw new IllegalStateException("unknown annotation type: " + standAloneAnnotation);
}
this.removeStandAloneAnnotation(declaration);
}
内容来源于网络,如有侵权,请联系作者删除!