Search in sources :

Example 76 with Attribute

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

the class MethodPropertyVisitor method visitEnd.

/**
 * End of the visit.
 * Append the computed element to the element element.
 *
 * @see org.objectweb.asm.AnnotationVisitor#visitEnd()
 */
public void visitEnd() {
    Element prop = visitEndCommon();
    prop.addAttribute(new Attribute("method", m_method));
}
Also used : Attribute(org.apache.felix.ipojo.metadata.Attribute) Element(org.apache.felix.ipojo.metadata.Element)

Example 77 with Attribute

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

the class MethodPropertyVisitor method getPropertyElement.

private Element getPropertyElement() {
    // Gather all the <property> Elements
    Element[] props = m_parent.getElements("property");
    Element prop = null;
    for (int i = 0; props != null && prop == null && i < props.length; i++) {
        // Get the first one with the good name
        String name = props[i].getAttribute("name");
        if (name != null && name.equals(m_name)) {
            prop = props[i];
        }
    }
    // Create the Element if not present
    if (prop == null) {
        prop = new Element("property", "");
        m_parent.addElement(prop);
        if (m_name != null) {
            prop.addAttribute(new Attribute("name", m_name));
        }
    }
    return prop;
}
Also used : Attribute(org.apache.felix.ipojo.metadata.Attribute) Element(org.apache.felix.ipojo.metadata.Element)

Example 78 with Attribute

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

the class ParameterPropertyVisitor method visitEnd.

/**
 * End of the visit.
 * Append the computed element to the element element.
 *
 * @see org.objectweb.asm.AnnotationVisitor#visitEnd()
 */
public void visitEnd() {
    Element prop = visitEndCommon();
    String type = Type.getArgumentTypes(node.desc)[m_index].getClassName();
    prop.addAttribute(new Attribute("type", type));
    prop.addAttribute(new Attribute("constructor-parameter", Integer.toString(m_index)));
}
Also used : Attribute(org.apache.felix.ipojo.metadata.Attribute) Element(org.apache.felix.ipojo.metadata.Element)

Example 79 with Attribute

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

the class ServiceControllerVisitor method visit.

/**
 * Visit one "simple" annotation.
 * @param name : annotation name
 * @param value : annotation value
 * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object)
 */
public void visit(String name, Object value) {
    if (name.equals("value")) {
        controller.addAttribute(new Attribute("value", value.toString()));
        return;
    }
    if (name.equals("specification")) {
        String spec = ((Type) value).getClassName();
        controller.addAttribute(new Attribute("specification", spec));
    }
}
Also used : Type(org.objectweb.asm.Type) Attribute(org.apache.felix.ipojo.metadata.Attribute)

Example 80 with Attribute

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

the class UpdatedVisitor method visitEnd.

@Override
public void visitEnd() {
    Element properties = Elements.getPropertiesElement(workbench);
    properties.addAttribute(new Attribute("updated", name));
}
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