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

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

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

Element.containsAttribute介绍

[英]Does the element contain an attribute of the name given in parameter.
[中]元素是否包含参数中给定名称的属性。

代码示例

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

/**
 * Find all the values of the specified attribute in the given element.
 * @param metadata Element to be traversed
 * @param attributeName Search attribute name
 * @return Set of attribute values (no duplicate).
 */
public static Set<String> findAttributes(Element metadata, String attributeName) {
  Set<String> referred = new HashSet<String>();
  // Search in the given element
  if (metadata.containsAttribute(attributeName)) {
    referred.add(metadata.getAttribute(attributeName));
  }
  // Search in children
  for (Element elem : metadata.getElements()) {
    Set<String> found = findAttributes(elem, attributeName);
    referred.addAll(found);
  }
  // Return all found values
  return referred;
}

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

private void addCallbacksToDependency(Element dependencyElement, Dependency dep) throws ConfigurationException {
  Element[] cbs = dependencyElement.getElements("Callback");
  for (int j = 0; cbs != null && j < cbs.length; j++) {
    if (!cbs[j].containsAttribute("method") || !cbs[j].containsAttribute("type")) {
      throw new ConfigurationException("Requirement Callback : a dependency callback must contain a method " +
          "and a type (bind or unbind) attribute");
    }
    String method = cbs[j].getAttribute("method");
    String type = cbs[j].getAttribute("type");
    int methodType = DependencyCallback.UNBIND;
    if ("bind".equalsIgnoreCase(type)) {
      methodType = DependencyCallback.BIND;
    } else if ("modified".equalsIgnoreCase(type)) {
      methodType = DependencyCallback.MODIFIED;
    }
    dep.addDependencyCallback(createDependencyHandler(dep, method, methodType));
  }
}

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

private void addCallbacksToDependency(Element dependencyElement, Dependency dep) throws ConfigurationException {
  Element[] cbs = dependencyElement.getElements("Callback");
  for (int j = 0; cbs != null && j < cbs.length; j++) {
    if (!cbs[j].containsAttribute("method") || !cbs[j].containsAttribute("type")) {
      throw new ConfigurationException("Requirement Callback : a dependency callback must contain a method " +
          "and a type (bind or unbind) attribute");
    }
    String method = cbs[j].getAttribute("method");
    String type = cbs[j].getAttribute("type");
    int methodType = DependencyCallback.UNBIND;
    if ("bind".equalsIgnoreCase(type)) {
      methodType = DependencyCallback.BIND;
    } else if ("modified".equalsIgnoreCase(type)) {
      methodType = DependencyCallback.MODIFIED;
    }
    dep.addDependencyCallback(createDependencyHandler(dep, method, methodType));
  }
}

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

if (publisher.containsAttribute(NAME_ATTRIBUTE)) {
  m_name = publisher.getAttribute(NAME_ATTRIBUTE);
} else {
if (publisher.containsAttribute(FIELD_ATTRIBUTE)) {
  m_field = publisher.getAttribute(FIELD_ATTRIBUTE);
} else {
if (publisher.containsAttribute(TOPICS_ATTRIBUTE)) {
  setTopics(publisher.getAttribute(TOPICS_ATTRIBUTE));
} else {
if (publisher.containsAttribute(SYNCHRONOUS_ATTRIBUTE)) {
  m_synchronous = "true".equalsIgnoreCase(publisher
      .getAttribute(SYNCHRONOUS_ATTRIBUTE));
if (publisher.containsAttribute(DATA_KEY_ATTRIBUTE)) {
  m_dataKey = publisher.getAttribute(DATA_KEY_ATTRIBUTE);
} else if (publisher.containsAttribute("data_key")) {
} else if (publisher.containsAttribute("dataKey")) {

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

if (publisher.containsAttribute(NAME_ATTRIBUTE)) {
  m_name = publisher.getAttribute(NAME_ATTRIBUTE);
} else {
if (publisher.containsAttribute(FIELD_ATTRIBUTE)) {
  m_field = publisher.getAttribute(FIELD_ATTRIBUTE);
} else {
if (publisher.containsAttribute(TOPICS_ATTRIBUTE)) {
  setTopics(publisher.getAttribute(TOPICS_ATTRIBUTE));
} else {
if (publisher.containsAttribute(SYNCHRONOUS_ATTRIBUTE)) {
  m_synchronous = "true".equalsIgnoreCase(publisher
      .getAttribute(SYNCHRONOUS_ATTRIBUTE));
if (publisher.containsAttribute(DATA_KEY_ATTRIBUTE)) {
  m_dataKey = publisher.getAttribute(DATA_KEY_ATTRIBUTE);
} else if (publisher.containsAttribute("data_key")) {
} else if (publisher.containsAttribute("dataKey")) {

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

if (subscriber.containsAttribute(NAME_ATTRIBUTE)) {
  m_name = subscriber.getAttribute(NAME_ATTRIBUTE);
} else {
if (subscriber.containsAttribute(CALLBACK_ATTRIBUTE)) {
  m_callback = subscriber.getAttribute(CALLBACK_ATTRIBUTE);
} else if (subscriber.containsAttribute("method")) {
  m_callback = subscriber.getAttribute("method");
} else {
if (subscriber.containsAttribute(TOPICS_ATTRIBUTE)) {
  setTopics(subscriber.getAttribute(TOPICS_ATTRIBUTE));
} else {
if (subscriber.containsAttribute(FILTER_ATTRIBUTE)) {
  setFilter(subscriber.getAttribute(FILTER_ATTRIBUTE));

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

if (subscriber.containsAttribute(NAME_ATTRIBUTE)) {
  m_name = subscriber.getAttribute(NAME_ATTRIBUTE);
} else {
if (subscriber.containsAttribute(CALLBACK_ATTRIBUTE)) {
  m_callback = subscriber.getAttribute(CALLBACK_ATTRIBUTE);
} else if (subscriber.containsAttribute("method")) {
  m_callback = subscriber.getAttribute("method");
} else {
if (subscriber.containsAttribute(TOPICS_ATTRIBUTE)) {
  setTopics(subscriber.getAttribute(TOPICS_ATTRIBUTE));
} else {
if (subscriber.containsAttribute(FILTER_ATTRIBUTE)) {
  setFilter(subscriber.getAttribute(FILTER_ATTRIBUTE));

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

if (!deps[i].containsAttribute("field") || m_dependencies.contains(deps[i].getAttribute("field"))) {
  error("One temporal dependency must be attached to a field or the field is already used");
  return;
if (deps[i].containsAttribute("id")) {
  id = deps[i].getAttribute("id");
if (deps[i].containsAttribute("timeout")) {
  String to = deps[i].getAttribute("timeout");
  if (to.equalsIgnoreCase("infinite") || to.equalsIgnoreCase("-1")) {

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

String field = attribute.getAttribute(JMX_FIELD_ELT);
if (attribute.containsAttribute(JMX_NAME_ELT)) {
  name = attribute.getAttribute(JMX_NAME_ELT);
} else {
  name = field;
if (attribute.containsAttribute(JMX_RIGHTS_ELT)) {
  rights = attribute.getAttribute(JMX_RIGHTS_ELT);
} else {
  getTypeFromAttributeField(field, manipulation));
if (attribute.containsAttribute(JMX_NOTIFICATION_ELT)) {
  notif = Boolean.parseBoolean(attribute
    .getAttribute(JMX_NOTIFICATION_ELT));
if (method.containsAttribute(JMX_DESCRIPTION_ELT)) {
  description = method.getAttribute(JMX_DESCRIPTION_ELT);

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

if (metadata.containsAttribute("nullable") || dependency.getDefaultImplementation() != null  || dependency
    .getException() != null) {
  if (metadata.containsAttribute("nullable")  && dependency.getDefaultImplementation() != null) {
    throw new ConfigurationException(message + "`nullable` and `default-implementation` cannot be " +
        "combined");
  if (metadata.containsAttribute("nullable") && dependency.getException() != null) {
    throw new ConfigurationException(message + "`nullable` and `exception` cannot be combined");

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

if (metadata.containsAttribute("nullable") || dependency.getDefaultImplementation() != null  || dependency
    .getException() != null) {
  if (metadata.containsAttribute("nullable")  && dependency.getDefaultImplementation() != null) {
    throw new ConfigurationException(message + "`nullable` and `default-implementation` cannot be " +
        "combined");
  if (metadata.containsAttribute("nullable") && dependency.getException() != null) {
    throw new ConfigurationException(message + "`nullable` and `exception` cannot be combined");

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

if (componentMetadata != null && componentMetadata.containsAttribute("name") && instanceMetadata != null) {

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

BundleContext bc = getBundleContextForConfiguration(element);
if (element.containsAttribute("constructor-parameter")) {
  String idx = element.getAttribute("constructor-parameter");
  int index = Integer.parseInt(idx);
} else if (element.containsAttribute("field")) {
  String field = element.getAttribute("field");
  final BundleContext injected = bc;
} else if (element.containsAttribute("method")) {
  String method = element.getAttribute("method");
  MethodMetadata mm = getFactory().getPojoMetadata().getMethod(method,

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

BundleContext bc = getBundleContextForConfiguration(element);
if (element.containsAttribute("constructor-parameter")) {
  String idx = element.getAttribute("constructor-parameter");
  int index = Integer.parseInt(idx);
} else if (element.containsAttribute("field")) {
  String field = element.getAttribute("field");
  final BundleContext injected = bc;
} else if (element.containsAttribute("method")) {
  String method = element.getAttribute("method");
  MethodMetadata mm = getFactory().getPojoMetadata().getMethod(method,

相关文章