Examples of AnnotationElement


Examples of org.jboss.forge.parser.java.AnnotationElement

   }

   @Test
   public void testAddAnnotationElementFromDeclarationWithDefaultValue()
   {
      AnnotationElement someElement = javaAnnotation
               .addAnnotationElement("String[] someElement() default {\"A\",\"B\",\"C\"};");
      assertTrue(javaAnnotation.hasAnnotationElement(someElement));

      assertEquals("someElement", someElement.getName());
      Type<JavaAnnotation> someElementType = someElement.getTypeInspector();
      assertTrue(someElementType.isArray());
      assertEquals(1, someElementType.getArrayDimensions());
      assertEquals("String[]", someElementType.getName());

      assertEquals("{\"A\",\"B\",\"C\"}", someElement.getDefaultValue().getLiteral());
   }
View Full Code Here

Examples of org.jboss.forge.parser.java.AnnotationElement

   }

   @Test
   public void testAddAnnotationElementFromDeclarationNoSemi()
   {
      AnnotationElement someElement = javaAnnotation.addAnnotationElement("String[] someElement()");
      assertTrue(javaAnnotation.hasAnnotationElement(someElement));

      assertEquals("someElement", someElement.getName());
      Type<JavaAnnotation> someElementType = someElement.getTypeInspector();
      assertTrue(someElementType.isArray());
      assertEquals(1, someElementType.getArrayDimensions());
      assertEquals("String[]", someElementType.getName());
   }
View Full Code Here

Examples of org.jboss.forge.parser.java.AnnotationElement

   }

   @Test
   public void testAddAnnotationElementFromDeclarationWithDefaultValueNoSemi()
   {
      AnnotationElement someElement = javaAnnotation
               .addAnnotationElement("String[] someElement() default {\"A\",\"B\",\"C\"}");
      assertTrue(javaAnnotation.hasAnnotationElement(someElement));

      assertEquals("someElement", someElement.getName());
      Type<JavaAnnotation> someElementType = someElement.getTypeInspector();
      assertTrue(someElementType.isArray());
      assertEquals(1, someElementType.getArrayDimensions());
      assertEquals("String[]", someElementType.getName());

      assertEquals("{\"A\",\"B\",\"C\"}", someElement.getDefaultValue().getLiteral());
   }
View Full Code Here

Examples of org.jboss.forge.parser.java.AnnotationElement

   }

   @Test
   public void testRemoveAnnotationElement()
   {
      AnnotationElement annotationElement = javaAnnotation.getAnnotationElements().get(0);
      assertTrue(javaAnnotation.hasAnnotationElement(annotationElement));
      javaAnnotation.removeAnnotationElement(annotationElement);
      assertFalse(javaAnnotation.hasAnnotationElement(annotationElement));
   }
View Full Code Here

Examples of org.jboss.forge.parser.java.AnnotationElement

   }

   @Test
   public void testChangeDefaultValue()
   {
      AnnotationElement value = javaAnnotation.getAnnotationElement("value");
      Annotation<JavaAnnotation> valueDefaultValue = value.getDefaultValue().getAnnotation();
      assertNotNull(valueDefaultValue);
      assertEquals("MockNestedJavaAnnotationType", valueDefaultValue.getName());
      assertTrue(valueDefaultValue.isSingleValue());
      assertEquals("-1", valueDefaultValue.getLiteralValue());

      value.getDefaultValue().setAnnotation().setName("MockNestedJavaAnnotationType").setLiteralValue("0")
               .setLiteralValue("charSequenceType", "StringBuffer.class")
               .setEnumValue("metasyntacticVariable", MockEnumType.BAR);
      valueDefaultValue = value.getDefaultValue().getAnnotation();
      assertNotNull(valueDefaultValue);
      assertEquals("MockNestedJavaAnnotationType", valueDefaultValue.getName());
      assertTrue(valueDefaultValue.isNormal());
      assertEquals("0", valueDefaultValue.getLiteralValue());
      assertEquals("StringBuffer.class", valueDefaultValue.getLiteralValue("charSequenceType"));
View Full Code Here

Examples of org.jf.dexlib2.iface.AnnotationElement

    }

    @Override
    public boolean equals(Object o) {
        if (o != null && o instanceof AnnotationElement) {
            AnnotationElement other = (AnnotationElement)o;
            return getName().equals(other.getName()) &&
                   getValue().equals(other.getValue());
        }
        return false;
    }
View Full Code Here

Examples of org.jibx.schema.elements.AnnotationElement

        }
       
        // add documentation if available
        List nodes = parm.getDocumentation();
        if (nodes != null) {
            AnnotationElement anno = new AnnotationElement();
            DocumentationElement doc = new DocumentationElement();
            for (Iterator iter = nodes.iterator(); iter.hasNext();) {
                Node node = (Node)iter.next();
                doc.addContent(node);
            }
            anno.getItemsList().add(doc);
            elem.setAnnotation(anno);
        }
        return elem;
    }
View Full Code Here

Examples of org.jibx.schema.elements.AnnotationElement

     */
    public void walkChildren(SchemaBase root, SchemaVisitor visitor) {
       
        // first expand the annotation, if present
        if (root instanceof AnnotatedBase) {
            AnnotationElement anno = ((AnnotatedBase)root).getAnnotation();
            if (anno != null) {
                walkElement(anno, visitor);
            }
        }
       
View Full Code Here

Examples of org.jibx.schema.elements.AnnotationElement

     * @return content of <b>documentation</b> elements, or <code>null</code> if none
     */
    protected String extractDocumentation(AnnotatedBase element) {
        if (m_schemaCustom.isJavaDocDocumentation()) {
            StringWriter writer = new StringWriter();
            AnnotationElement anno = element.getAnnotation();
            if (anno != null) {
                FilteredSegmentList items = anno.getItemsList();
                for (int i = 0; i < items.size(); i++) {
                    AnnotationItem item = (AnnotationItem)items.get(i);
                    if (item instanceof DocumentationElement) {
                        DocumentationElement doc = (DocumentationElement)item;
                        List contents = doc.getContent();
View Full Code Here

Examples of org.jibx.schema.elements.AnnotationElement

    private void addDocumentation(IClass info, AnnotatedBase root) {
        ClassCustom custom = m_custom.getClassCustomization(info.getName());
        if (info != null && custom.isUseJavaDocs()) {
            List nodes = m_formatCache.getFormatter(custom).getClassDocumentation(info);
            if (nodes != null) {
                AnnotationElement anno = new AnnotationElement();
                DocumentationElement doc = new DocumentationElement();
                for (Iterator iter = nodes.iterator(); iter.hasNext();) {
                    Node node = (Node)iter.next();
                    doc.addContent(node);
                }
                anno.getItemsList().add(doc);
                root.setAnnotation(anno);
            }
        }
    }
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.