Search in sources :

Example 26 with Attribute

use of org.apache.felix.ipojo.metadata.Attribute in project felix by apache.

the class MetadataRenderer method renderElement.

private void renderElement(Element element, StringBuilder builder) {
    // If the element is already here, do not re-add the element.
    if (!isFiltered(element)) {
        // Print the beginning of the element
        startElement(element, builder);
        // Render all attributes
        for (Attribute attribute : element.getAttributes()) {
            renderAttribute(attribute, builder);
        }
        // Render child elements
        for (Element child : element.getElements()) {
            renderElement(child, builder);
        }
        // Print the end of the element
        endElement(builder);
    }
}
Also used : Attribute(org.apache.felix.ipojo.metadata.Attribute) Element(org.apache.felix.ipojo.metadata.Element)

Example 27 with Attribute

use of org.apache.felix.ipojo.metadata.Attribute in project felix by apache.

the class CompositeMetadataProviderTestCase method newComponentElement.

private Element newComponentElement(String type) {
    Element main = new Element("component", null);
    main.addAttribute(new Attribute("name", type));
    return main;
}
Also used : Attribute(org.apache.felix.ipojo.metadata.Attribute) Element(org.apache.felix.ipojo.metadata.Element)

Example 28 with Attribute

use of org.apache.felix.ipojo.metadata.Attribute in project felix by apache.

the class CompositeMetadataProviderTestCase method newInstanceElement.

private Element newInstanceElement(String type, String name) {
    Element main = new Element("instance", null);
    main.addAttribute(new Attribute("component", type));
    main.addAttribute(new Attribute("name", name));
    return main;
}
Also used : Attribute(org.apache.felix.ipojo.metadata.Attribute) Element(org.apache.felix.ipojo.metadata.Element)

Example 29 with Attribute

use of org.apache.felix.ipojo.metadata.Attribute in project felix by apache.

the class ManipulatedMetadataFilterTestCase method testDoNotFilterOthers.

public void testDoNotFilterOthers() throws Exception {
    Element main = new Element("test", null);
    main.addAttribute(new Attribute("name", "setPropertyName"));
    Assert.assertFalse(filter.accept(main));
}
Also used : Attribute(org.apache.felix.ipojo.metadata.Attribute) Element(org.apache.felix.ipojo.metadata.Element)

Example 30 with Attribute

use of org.apache.felix.ipojo.metadata.Attribute in project felix by apache.

the class MetadataRendererTestCase method testRenderElementWithNoNamespaceAttribute.

public void testRenderElementWithNoNamespaceAttribute() throws Exception {
    Element main = new Element("test", null);
    main.addAttribute(new Attribute("name", "attribute"));
    String rendered = renderer.render(main);
    Assert.assertEquals("test { $name=\"attribute\" }", rendered);
}
Also used : Attribute(org.apache.felix.ipojo.metadata.Attribute) Element(org.apache.felix.ipojo.metadata.Element)

Aggregations

Attribute (org.apache.felix.ipojo.metadata.Attribute)125 Element (org.apache.felix.ipojo.metadata.Element)109 Test (org.junit.Test)9 PojoMetadata (org.apache.felix.ipojo.parser.PojoMetadata)6 Iterator (java.util.Iterator)4 Enumeration (java.util.Enumeration)3 Map (java.util.Map)3 Set (java.util.Set)3 ServiceReference (org.osgi.framework.ServiceReference)3 List (java.util.List)2 Entry (java.util.Map.Entry)2 PropertyDescription (org.apache.felix.ipojo.architecture.PropertyDescription)2 FieldMetadata (org.apache.felix.ipojo.parser.FieldMetadata)2 MethodMetadata (org.apache.felix.ipojo.parser.MethodMetadata)2 Type (org.objectweb.asm.Type)2 Member (java.lang.reflect.Member)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 ExecutorService (java.util.concurrent.ExecutorService)1