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);
}
}
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;
}
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;
}
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));
}
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);
}
Aggregations