Examples of SingleMemberAnnotation


Examples of org.eclipse.jdt.core.dom.SingleMemberAnnotation

   public String getLiteralValue() throws IllegalStateException
   {
      String result = null;
      if (isSingleValue())
      {
         SingleMemberAnnotation sm = (SingleMemberAnnotation) annotation;
         result = sm.getValue().toString();
      }
      else if (isNormal())
      {
         List<ValuePair> values = getValues();
         for (ValuePair pair : values)
View Full Code Here

Examples of org.eclipse.jdt.core.dom.SingleMemberAnnotation

         convertTo(AnnotationType.SINGLE);
      }

      if (isSingleValue())
      {
         SingleMemberAnnotation sa = (SingleMemberAnnotation) annotation;

         String stub = "@" + getName() + "(" + value + ") public class Stub { }";
         JavaClass temp = (JavaClass) JavaParser.parse(stub);

         SingleMemberAnnotation anno = (SingleMemberAnnotation) temp.getAnnotations().get(0).getInternal();

         Expression expression = anno.getValue();
         sa.setValue((Expression) ASTNode.copySubtree(ast, expression));
      }
      else
      {
         setLiteralValue(DEFAULT_VALUE, value);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.SingleMemberAnnotation

   @Override
   public Annotation<O> getAnnotationValue()
   {
      if (isSingleValue())
      {
         SingleMemberAnnotation single = (SingleMemberAnnotation) annotation;
         Expression value = single.getValue();
         if (value instanceof org.eclipse.jdt.core.dom.Annotation)
         {
            return new Nested(this, value);
         }
      }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation

      } else {
        this.contents[this.contentsOffset++] = 0;
        this.contents[this.contentsOffset++] = 0;
      }
    } else if (annotation instanceof SingleMemberAnnotation) {
      SingleMemberAnnotation singleMemberAnnotation = (SingleMemberAnnotation) annotation;
      // this is a single member annotation (one member value)
      this.contents[this.contentsOffset++] = 0;
      this.contents[this.contentsOffset++] = 1;
      if (this.contentsOffset + 2 >= this.contents.length) {
        resizeContents(2);
      }
      final int elementNameIndex = this.constantPool.literalIndex(VALUE);
      this.contents[this.contentsOffset++] = (byte) (elementNameIndex >> 8);
      this.contents[this.contentsOffset++] = (byte) elementNameIndex;
      MethodBinding methodBinding = singleMemberAnnotation.memberValuePairs()[0].binding;
      if (methodBinding == null) {
        this.contentsOffset = startingContentsOffset;
      } else {
        try {
          generateElementValue(singleMemberAnnotation.memberValue, methodBinding.returnType, startingContentsOffset);
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation

    LocalDeclaration localDeclaration = new LocalDeclaration(null, 0, 0);
    localDeclaration.type = createMockBinaryTypeReference(binaryTypeBinding);
    methodDeclaration.statements = new Statement[] {localDeclaration};

    SingleMemberAnnotation annotation = new SingleMemberAnnotation(
        createMockBinaryTypeReference(binaryTypeBinding), 0);
    annotation.memberValue = annotation.type;
    typeDeclaration.annotations = new Annotation[] {annotation};

    typeDeclaration.methods = new AbstractMethodDeclaration[] {methodDeclaration};
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation

      } else {
        this.contents[this.contentsOffset++] = 0;
        this.contents[this.contentsOffset++] = 0;
      }
    } else if (annotation instanceof SingleMemberAnnotation) {
      SingleMemberAnnotation singleMemberAnnotation = (SingleMemberAnnotation) annotation;
      // this is a single member annotation (one member value)
      this.contents[this.contentsOffset++] = 0;
      this.contents[this.contentsOffset++] = 1;
      if (this.contentsOffset + 2 >= this.contents.length) {
        resizeContents(2);
      }
      final int elementNameIndex = this.constantPool.literalIndex(VALUE);
      this.contents[this.contentsOffset++] = (byte) (elementNameIndex >> 8);
      this.contents[this.contentsOffset++] = (byte) elementNameIndex;
      MethodBinding methodBinding = singleMemberAnnotation.memberValuePairs()[0].binding;
      if (methodBinding == null) {
        this.contentsOffset = startingContentsOffset;
      } else {
        int memberValuePairOffset = this.contentsOffset;
        try {
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation

      } else {
        this.contents[this.contentsOffset++] = 0;
        this.contents[this.contentsOffset++] = 0;
      }
    } else if (annotation instanceof SingleMemberAnnotation) {
      SingleMemberAnnotation singleMemberAnnotation = (SingleMemberAnnotation) annotation;
      // this is a single member annotation (one member value)
      this.contents[this.contentsOffset++] = 0;
      this.contents[this.contentsOffset++] = 1;
      if (this.contentsOffset + 2 >= this.contents.length) {
        resizeContents(2);
      }
      final int elementNameIndex = this.constantPool.literalIndex(VALUE);
      this.contents[this.contentsOffset++] = (byte) (elementNameIndex >> 8);
      this.contents[this.contentsOffset++] = (byte) elementNameIndex;
      MethodBinding methodBinding = singleMemberAnnotation.memberValuePairs()[0].binding;
      if (methodBinding == null) {
        this.contentsOffset = startingContentsOffset;
      } else {
        try {
          generateElementValue(singleMemberAnnotation.memberValue, methodBinding.returnType, startingContentsOffset);
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation

      } else {
        this.contents[this.contentsOffset++] = 0;
        this.contents[this.contentsOffset++] = 0;
      }
    } else if (annotation instanceof SingleMemberAnnotation) {
      SingleMemberAnnotation singleMemberAnnotation = (SingleMemberAnnotation) annotation;
      // this is a single member annotation (one member value)
      this.contents[this.contentsOffset++] = 0;
      this.contents[this.contentsOffset++] = 1;
      if (this.contentsOffset + 2 >= this.contents.length) {
        resizeContents(2);
      }
      final int elementNameIndex = this.constantPool.literalIndex(VALUE);
      this.contents[this.contentsOffset++] = (byte) (elementNameIndex >> 8);
      this.contents[this.contentsOffset++] = (byte) elementNameIndex;
      MethodBinding methodBinding = singleMemberAnnotation.memberValuePairs()[0].binding;
      if (methodBinding == null) {
        this.contentsOffset = startingContentsOffset;
      } else {
        try {
          generateElementValue(singleMemberAnnotation.memberValue, methodBinding.returnType, startingContentsOffset);
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation

      } else {
        this.contents[this.contentsOffset++] = 0;
        this.contents[this.contentsOffset++] = 0;
      }
    } else if (annotation instanceof SingleMemberAnnotation) {
      SingleMemberAnnotation singleMemberAnnotation = (SingleMemberAnnotation) annotation;
      // this is a single member annotation (one member value)
      this.contents[this.contentsOffset++] = 0;
      this.contents[this.contentsOffset++] = 1;
      if (this.contentsOffset + 2 >= this.contents.length) {
        resizeContents(2);
      }
      final int elementNameIndex = this.constantPool.literalIndex(VALUE);
      this.contents[this.contentsOffset++] = (byte) (elementNameIndex >> 8);
      this.contents[this.contentsOffset++] = (byte) elementNameIndex;
      MethodBinding methodBinding = singleMemberAnnotation.memberValuePairs()[0].binding;
      if (methodBinding == null) {
        this.contentsOffset = startingContentsOffset;
      } else {
        try {
          generateElementValue(singleMemberAnnotation.memberValue, methodBinding.returnType, startingContentsOffset);
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation

  pushOnAstStack(new AssertStatement(this.expressionStack[this.expressionPtr--], this.intStack[this.intPtr--]));
}
protected void consumeSingleMemberAnnotation(boolean isTypeAnnotation) {
  // SingleMemberTypeAnnotation ::= TypeAnnotationName '(' SingleMemberAnnotationMemberValue ')'
  // SingleMemberAnnotation ::= AnnotationName '(' SingleMemberAnnotationMemberValue ')'
  SingleMemberAnnotation singleMemberAnnotation = null;

  int oldIndex = this.identifierPtr;

  TypeReference typeReference = getAnnotationType();
  singleMemberAnnotation = new SingleMemberAnnotation(typeReference, this.intStack[this.intPtr--]);
  singleMemberAnnotation.memberValue = this.expressionStack[this.expressionPtr--];
  this.expressionLengthPtr--;
  singleMemberAnnotation.declarationSourceEnd = this.rParenPos;
 
  if (isTypeAnnotation) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.