use of org.apache.felix.ipojo.metadata.Attribute in project felix by apache.
the class Manipulator method getManipulationMetadata.
/**
* Compute component type manipulation metadata.
* @return the manipulation metadata of the class.
*/
public Element getManipulationMetadata() {
Element elem = new Element("Manipulation", "");
elem.addAttribute(new Attribute("className", toQualifiedName(m_className)));
if (m_superClass != null) {
elem.addAttribute(new Attribute("super", m_superClass));
}
for (String m_interface : m_interfaces) {
Element itf = new Element("Interface", "");
Attribute att = new Attribute("name", m_interface);
itf.addAttribute(att);
elem.addElement(itf);
}
for (Map.Entry<String, String> f : m_fields.entrySet()) {
Element field = new Element("Field", "");
Attribute attName = new Attribute("name", f.getKey());
Attribute attType = new Attribute("type", f.getValue());
field.addAttribute(attName);
field.addAttribute(attType);
elem.addElement(field);
}
for (MethodDescriptor method : m_methods) {
elem.addElement(method.getElement());
}
for (Map.Entry<String, List<MethodDescriptor>> inner : m_inners.entrySet()) {
Element element = new Element("Inner", "");
Attribute name = new Attribute("name", extractInnerClassName(toQualifiedName(inner.getKey())));
element.addAttribute(name);
for (MethodDescriptor method : inner.getValue()) {
element.addElement(method.getElement());
}
elem.addElement(element);
}
return elem;
}
use of org.apache.felix.ipojo.metadata.Attribute in project felix by apache.
the class ClassMetadataCollector method visitEnd.
/**
* End of the visit : compute final elements.
*
* @see org.objectweb.asm.ClassVisitor#visitEnd()
*/
@Override
public void visitEnd() {
// Only process real class (no annotations, no interfaces)
if (!(is(Opcodes.ACC_ANNOTATION) || is(Opcodes.ACC_INTERFACE) || is(Opcodes.ACC_ABSTRACT))) {
if (workbench.getRoot() == null) {
if (workbench.ignore()) {
// Ignore this class.
return;
}
if (!workbench.getElements().isEmpty()) {
// There are other annotation's contribution on this type (additional handler declaration/configuration)
// That means that there is a missing 'component type' annotation
reporter.warn("Class %s has not been marked as a component type (no @Component, @Handler, " + "...). It will be ignored by the iPOJO manipulator.", workbench.getType().getClassName());
return;
}
// else: no root and no elements
return;
}
componentMetadata = workbench.build();
instanceMetadata = workbench.getInstance();
// of the instance (https://issues.apache.org/jira/browse/FELIX-4052).
if (componentMetadata != null && componentMetadata.containsAttribute("name") && instanceMetadata != null) {
// Update the component attribute
instanceMetadata.addAttribute(new Attribute("component", componentMetadata.getAttribute("name")));
}
}
}
use of org.apache.felix.ipojo.metadata.Attribute in project felix by apache.
the class TestBadFactories method getElementHandlerFactoryWithNoClassName.
private Element getElementHandlerFactoryWithNoClassName() {
Element elem = new Element("handler", "");
elem.addAttribute(new Attribute("name", "noclassname"));
return elem;
}
use of org.apache.felix.ipojo.metadata.Attribute in project felix by apache.
the class TestBadLFCCallback method getBadTransition.
private Element getBadTransition() {
Element elem = new Element("component", "");
elem.addAttribute(new Attribute("classname", clazz));
Element callback = new Element("callback", "");
callback.addAttribute(new Attribute("method", "start"));
callback.addAttribute(new Attribute("transition", "validate_"));
elem.addElement(callback);
elem.addElement(manipulation);
return elem;
}
use of org.apache.felix.ipojo.metadata.Attribute in project felix by apache.
the class TestBadLFCCallback method getNoTransition.
private Element getNoTransition() {
Element elem = new Element("component", "");
elem.addAttribute(new Attribute("classname", clazz));
Element callback = new Element("callback", "");
callback.addAttribute(new Attribute("method", "start"));
elem.addElement(callback);
elem.addElement(manipulation);
return elem;
}
Aggregations