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

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

本文整理了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

/**
 * Visit an annotation attribute.
 *
 * @param name  the attribute name
 * @param value the attribute value
 * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object)
 */
public void visit(String name, Object value) {
  if (name.equals("name")) {
    instance.addAttribute(new Attribute("name", (String) value));
  }
}

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

/**
 * Constructor.
 * @param provides : element element.
 * @param field : field name.
 */
public ServiceControllerVisitor(String field, Element provides) {
  super(Opcodes.ASM5);
  this.provides = provides;
  controller.addAttribute(new Attribute("field", field));
}

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

private void computeInterceptorDescription(ServiceReference ref, Element itcp) {
  itcp.addAttribute(new Attribute(Constants.SERVICE_ID, ref.getProperty(Constants.SERVICE_ID).toString()));
  itcp.addAttribute(new Attribute("bundle.id", Long.toString(ref.getBundle().getBundleId())));
  String instance = (String) ref.getProperty(Factory.INSTANCE_NAME_PROPERTY);
  if (instance != null) {
    itcp.addAttribute(new Attribute(Factory.INSTANCE_NAME_PROPERTY, instance));
  }
  itcp.addAttribute(new Attribute("target", ref.getProperty(ServiceTrackingInterceptor.TARGET_PROPERTY)
      .toString()));
}

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

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

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

private void computeInterceptorDescription(ServiceReference ref, Element itcp) {
  itcp.addAttribute(new Attribute(Constants.SERVICE_ID, ref.getProperty(Constants.SERVICE_ID).toString()));
  itcp.addAttribute(new Attribute("bundle.id", Long.toString(ref.getBundle().getBundleId())));
  String instance = (String) ref.getProperty(Factory.INSTANCE_NAME_PROPERTY);
  if (instance != null) {
    itcp.addAttribute(new Attribute(Factory.INSTANCE_NAME_PROPERTY, instance));
  }
  itcp.addAttribute(new Attribute("target", ref.getProperty(ServiceTrackingInterceptor.TARGET_PROPERTY)
      .toString()));
}

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

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

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

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

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

/**
 * End of the visit.
 *
 * @see org.objectweb.asm.AnnotationVisitor#visitEnd()
 */
public void visitEnd() {
  if (m_acc != null) {
    // We have analyzed an attribute
    m_elem.addAttribute(new Attribute(m_name, m_acc + "}"));
  }
}

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

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

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

/**
   * Visits an enumeration attribute.
   *
   * @param name  the attribute name
   * @param desc  the enumeration descriptor
   * @param value the attribute value
   * @see org.objectweb.asm.AnnotationVisitor#visitEnum(String, String, String)
   */
  public void visitEnum(String name, String desc, String value) {
    element.addAttribute(new Attribute(name, value));
  }
}

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

@Override
  public void visitEnd() {
    super.visitEnd();

    String type = Type.getArgumentTypes(node.desc)[index].getClassName();
    // TODO Is the 'index' attribute required ?
    element.addAttribute(new Attribute("index", Integer.toString(index)));
    element.addAttribute(new Attribute("type", type));
    element.addAttribute(new Attribute("constructor-parameter", Integer.toString(index)));

  }
}

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

@Override
  public void visitEnd() {
    Element cb = new Element("callback", "");
    cb.addAttribute(new Attribute("transition", transition.name().toLowerCase()));
    cb.addAttribute(new Attribute("method", name));
    workbench.getElements().put(cb, null);
  }
}

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

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

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

/**
 * 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));
}

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

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

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

@Override
  public void visitEnd() {
    Element provides;
    if (workbench.getIds().containsKey("provides")) {
      provides = workbench.getIds().get("provides");
      provides.addAttribute(new Attribute("post-registration", name));
    }
    // Else ignore annotation ...
  }
}

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

@Override
  public void visitEnd() {
    Element provides;
    if (workbench.getIds().containsKey("provides")) {
      provides = workbench.getIds().get("provides");
      provides.addAttribute(new Attribute("post-unregistration", name));
    }
    // Else ignore annotation ...
  }
}

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

/**
 * Declares an instance.
 *
 * @param workbench the workbench
 * @return the Instance element
 */
public static Element declareInstance(ComponentWorkbench workbench) {
  Element instance = new Element("instance", "");
  instance.addAttribute(new Attribute(COMPONENT, workbench.getType().getClassName()));
  return instance;
}

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

/**
   * Visit @Handler annotation attributes.
   * @see org.objectweb.asm.AnnotationVisitor#visit(String, Object)
   */
  public void visitEnd() {
    Element controller = new Element("controller", "");
    controller.addAttribute(new Attribute("field", field));
    workbench.getElements().put(controller, null);
  }
}

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

/**
   * End of the visit. Creates the instance element.
   *
   * @see org.objectweb.asm.AnnotationVisitor#visitEnd()
   */
  public void visitEnd() {
    // We set the instance's component attribute to the class name, if the component type has a custom name,
    // we will update it.
    instance.addAttribute(new Attribute("component", workbench.getType().getClassName()));

    workbench.setInstance(instance);

  }
}

相关文章