org.apache.felix.ipojo.metadata.Element.addAttribute()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(601)

本文整理了Java中org.apache.felix.ipojo.metadata.Element.addAttribute()方法的一些代码示例,展示了Element.addAttribute()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.addAttribute()方法的具体详情如下:
包路径:org.apache.felix.ipojo.metadata.Element
类名称:Element
方法名:addAttribute

Element.addAttribute介绍

[英]Adds a attribute.
[中]添加一个属性。

代码示例

代码示例来源:origin: apache/felix

  1. /**
  2. * Visit an annotation attribute.
  3. *
  4. * @param name the attribute name
  5. * @param value the attribute value
  6. * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object)
  7. */
  8. public void visit(String name, Object value) {
  9. if (name.equals("name")) {
  10. instance.addAttribute(new Attribute("name", (String) value));
  11. }
  12. }

代码示例来源:origin: apache/felix

  1. /**
  2. * Constructor.
  3. * @param provides : element element.
  4. * @param field : field name.
  5. */
  6. public ServiceControllerVisitor(String field, Element provides) {
  7. super(Opcodes.ASM5);
  8. this.provides = provides;
  9. controller.addAttribute(new Attribute("field", field));
  10. }

代码示例来源:origin: org.apache.felix/org.apache.felix.ipojo

  1. private void computeInterceptorDescription(ServiceReference ref, Element itcp) {
  2. itcp.addAttribute(new Attribute(Constants.SERVICE_ID, ref.getProperty(Constants.SERVICE_ID).toString()));
  3. itcp.addAttribute(new Attribute("bundle.id", Long.toString(ref.getBundle().getBundleId())));
  4. String instance = (String) ref.getProperty(Factory.INSTANCE_NAME_PROPERTY);
  5. if (instance != null) {
  6. itcp.addAttribute(new Attribute(Factory.INSTANCE_NAME_PROPERTY, instance));
  7. }
  8. itcp.addAttribute(new Attribute("target", ref.getProperty(ServiceTrackingInterceptor.TARGET_PROPERTY)
  9. .toString()));
  10. }

代码示例来源:origin: org.apache.felix/org.apache.felix.ipojo

  1. private void computeServiceReferenceDescription(ServiceReference ref, Element use) {
  2. use.addAttribute(new Attribute(Constants.SERVICE_ID, ref.getProperty(Constants.SERVICE_ID).toString()));
  3. String instance = (String) ref.getProperty(Factory.INSTANCE_NAME_PROPERTY);
  4. if (instance != null) {
  5. use.addAttribute(new Attribute(Factory.INSTANCE_NAME_PROPERTY, instance));
  6. }
  7. }

代码示例来源:origin: apache/felix

  1. private void computeInterceptorDescription(ServiceReference ref, Element itcp) {
  2. itcp.addAttribute(new Attribute(Constants.SERVICE_ID, ref.getProperty(Constants.SERVICE_ID).toString()));
  3. itcp.addAttribute(new Attribute("bundle.id", Long.toString(ref.getBundle().getBundleId())));
  4. String instance = (String) ref.getProperty(Factory.INSTANCE_NAME_PROPERTY);
  5. if (instance != null) {
  6. itcp.addAttribute(new Attribute(Factory.INSTANCE_NAME_PROPERTY, instance));
  7. }
  8. itcp.addAttribute(new Attribute("target", ref.getProperty(ServiceTrackingInterceptor.TARGET_PROPERTY)
  9. .toString()));
  10. }

代码示例来源:origin: apache/felix

  1. private void computeServiceReferenceDescription(ServiceReference ref, Element use) {
  2. use.addAttribute(new Attribute(Constants.SERVICE_ID, ref.getProperty(Constants.SERVICE_ID).toString()));
  3. String instance = (String) ref.getProperty(Factory.INSTANCE_NAME_PROPERTY);
  4. if (instance != null) {
  5. use.addAttribute(new Attribute(Factory.INSTANCE_NAME_PROPERTY, instance));
  6. }
  7. }

代码示例来源:origin: apache/felix

  1. /**
  2. * End of the array visit.
  3. * Add the attribute to 'provides' element.
  4. *
  5. * @see org.objectweb.asm.AnnotationVisitor#visitEnd()
  6. */
  7. public void visitEnd() {
  8. m_prov.addAttribute(new Attribute("specifications", m_itfs + "}"));
  9. }

代码示例来源:origin: apache/felix

  1. /**
  2. * End of the visit.
  3. *
  4. * @see org.objectweb.asm.AnnotationVisitor#visitEnd()
  5. */
  6. public void visitEnd() {
  7. if (m_acc != null) {
  8. // We have analyzed an attribute
  9. m_elem.addAttribute(new Attribute(m_name, m_acc + "}"));
  10. }
  11. }

代码示例来源:origin: apache/felix

  1. public FieldGenericVisitor(ComponentWorkbench workbench, Element element, FieldNode node) {
  2. super(workbench, element, ElementType.FIELD);
  3. element.addAttribute(new Attribute("field", node.name));
  4. }
  5. }

代码示例来源:origin: apache/felix

  1. /**
  2. * Visits an enumeration attribute.
  3. *
  4. * @param name the attribute name
  5. * @param desc the enumeration descriptor
  6. * @param value the attribute value
  7. * @see org.objectweb.asm.AnnotationVisitor#visitEnum(String, String, String)
  8. */
  9. public void visitEnum(String name, String desc, String value) {
  10. element.addAttribute(new Attribute(name, value));
  11. }
  12. }

代码示例来源:origin: apache/felix

  1. @Override
  2. public void visitEnd() {
  3. super.visitEnd();
  4. String type = Type.getArgumentTypes(node.desc)[index].getClassName();
  5. // TODO Is the 'index' attribute required ?
  6. element.addAttribute(new Attribute("index", Integer.toString(index)));
  7. element.addAttribute(new Attribute("type", type));
  8. element.addAttribute(new Attribute("constructor-parameter", Integer.toString(index)));
  9. }
  10. }

代码示例来源:origin: apache/felix

  1. @Override
  2. public void visitEnd() {
  3. Element cb = new Element("callback", "");
  4. cb.addAttribute(new Attribute("transition", transition.name().toLowerCase()));
  5. cb.addAttribute(new Attribute("method", name));
  6. workbench.getElements().put(cb, null);
  7. }
  8. }

代码示例来源:origin: apache/felix

  1. public MethodGenericVisitor(ComponentWorkbench workbench, Element element, MethodNode node) {
  2. super(workbench, element, ElementType.METHOD);
  3. element.addAttribute(new Attribute("method", computeEffectiveMethodName(node.name)));
  4. }
  5. }

代码示例来源:origin: apache/felix

  1. /**
  2. * End of the visit.
  3. * Append the computed element to the element element.
  4. *
  5. * @see org.objectweb.asm.AnnotationVisitor#visitEnd()
  6. */
  7. public void visitEnd() {
  8. Element prop = visitEndCommon();
  9. prop.addAttribute(new Attribute("method", m_method));
  10. }

代码示例来源:origin: apache/felix

  1. @Override
  2. public void visitEnd() {
  3. Element properties = Elements.getPropertiesElement(workbench);
  4. properties.addAttribute(new Attribute("updated", name));
  5. }

代码示例来源:origin: apache/felix

  1. @Override
  2. public void visitEnd() {
  3. Element provides;
  4. if (workbench.getIds().containsKey("provides")) {
  5. provides = workbench.getIds().get("provides");
  6. provides.addAttribute(new Attribute("post-registration", name));
  7. }
  8. // Else ignore annotation ...
  9. }
  10. }

代码示例来源:origin: apache/felix

  1. @Override
  2. public void visitEnd() {
  3. Element provides;
  4. if (workbench.getIds().containsKey("provides")) {
  5. provides = workbench.getIds().get("provides");
  6. provides.addAttribute(new Attribute("post-unregistration", name));
  7. }
  8. // Else ignore annotation ...
  9. }
  10. }

代码示例来源:origin: org.wisdom-framework/wisdom-ipojo-module

  1. /**
  2. * Declares an instance.
  3. *
  4. * @param workbench the workbench
  5. * @return the Instance element
  6. */
  7. public static Element declareInstance(ComponentWorkbench workbench) {
  8. Element instance = new Element("instance", "");
  9. instance.addAttribute(new Attribute(COMPONENT, workbench.getType().getClassName()));
  10. return instance;
  11. }

代码示例来源:origin: apache/felix

  1. /**
  2. * Visit @Handler annotation attributes.
  3. * @see org.objectweb.asm.AnnotationVisitor#visit(String, Object)
  4. */
  5. public void visitEnd() {
  6. Element controller = new Element("controller", "");
  7. controller.addAttribute(new Attribute("field", field));
  8. workbench.getElements().put(controller, null);
  9. }
  10. }

代码示例来源:origin: apache/felix

  1. /**
  2. * End of the visit. Creates the instance element.
  3. *
  4. * @see org.objectweb.asm.AnnotationVisitor#visitEnd()
  5. */
  6. public void visitEnd() {
  7. // We set the instance's component attribute to the class name, if the component type has a custom name,
  8. // we will update it.
  9. instance.addAttribute(new Attribute("component", workbench.getType().getClassName()));
  10. workbench.setInstance(instance);
  11. }
  12. }

相关文章