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

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

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

Element.getAttribute介绍

[英]Returns the value of the attribute given in parameter.
[中]返回参数中给定的属性值。

代码示例

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

private String initComponentName() {
  String name = m_componentMetadata.getAttribute("name");
  if (name == null) {
    name = m_componentMetadata.getAttribute("classname");
  }
  return name;
}

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

/**
 * Creates a field metadata.
 * This constructor is used when creating the {@link PojoMetadata}
 * object.
 * @param metadata the field manipulation element from Manipulation
 * Metadata.
 */
FieldMetadata(Element metadata) {
  m_name = metadata.getAttribute("name");
  m_type = metadata.getAttribute("type");
}

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

/**
 * Return the {@literal classname} attribute value.
 * @param meta metadata to be explored
 * @return the {@literal classname} attribute value or {@literal null} if
 *         the attribute does not exists.
 */
public static String getComponentType(Element meta) {
  return meta.getAttribute("classname");
}

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

/**
 * Creates a field metadata.
 * This constructor is used when creating the {@link PojoMetadata}
 * object.
 * @param metadata the field manipulation element from Manipulation
 * Metadata.
 */
FieldMetadata(Element metadata) {
  m_name = metadata.getAttribute("name");
  m_type = metadata.getAttribute("type");
}

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

private String initComponentName() {
  String name = m_componentMetadata.getAttribute("name");
  if (name == null) {
    name = m_componentMetadata.getAttribute("classname");
  }
  return name;
}

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

private String getComponentName(Element element) {
  return element.getAttribute("name");
}

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

public String getFactoryName() {
  return m_componentMetadata.getAttribute("name"); // Mandatory attribute.
}

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

private String getServiceSpecificationAttribute(Element dep) {
  String serviceSpecification = dep.getAttribute("interface");
  // the 'interface' attribute is deprecated
  if (serviceSpecification != null) {
    warn("The 'interface' attribute is deprecated, use the 'specification' attribute instead");
  } else {
    serviceSpecification = dep.getAttribute("specification");
  }
  return serviceSpecification;
}

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

/**
 * Returns the value of the attribute "name" of the namespace "ns".
 * @param name the name of the attribute to find
 * @param ns the namespace of the attribute to find
 * @return the String value of the attribute, or
 * <code>null</code> if the attribute is not found.
 */
public String getAttribute(String name, String ns) {
  name = ns.toLowerCase() + ":" + name.toLowerCase();
  return getAttribute(name);
}

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

/**
 * Returns the value of the attribute "name" of the namespace "ns".
 * @param name the name of the attribute to find
 * @param ns the namespace of the attribute to find
 * @return the String value of the attribute, or
 * <code>null</code> if the attribute is not found.
 */
public String getAttribute(String name, String ns) {
  name = ns.toLowerCase() + ":" + name.toLowerCase();
  return getAttribute(name);
}

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

private String getServiceSpecificationAttribute(Element dep) {
  String serviceSpecification = dep.getAttribute("interface");
  // the 'interface' attribute is deprecated
  if (serviceSpecification != null) {
    warn("The 'interface' attribute is deprecated, use the 'specification' attribute instead");
  } else {
    serviceSpecification = dep.getAttribute("specification");
  }
  return serviceSpecification;
}

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

private String initComponentVersion(BundleContext bundleContext) {
  String version = m_componentMetadata.getAttribute("version");
  if (version != null) {
    if ("bundle".equalsIgnoreCase(version)) {
      return bundleContext.getBundle().getHeaders().get(Constants.BUNDLE_VERSION);
    }
  }
  return version;
}

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

private String initComponentVersion(BundleContext bundleContext) {
  String version = m_componentMetadata.getAttribute("version");
  if (version != null) {
    if ("bundle".equalsIgnoreCase(version)) {
      return bundleContext.getBundle().getHeaders().get(Constants.BUNDLE_VERSION);
    }
  }
  return version;
}

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

/**
 * Returns the {@literal classname} attribute value.
 */
private String getComponentClassname() {
  return m_declaration.getComponentMetadata().getAttribute("classname");
}

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

/**
 * Check if the metadata are well formed.
 * @param metadata : metadata
 * @throws ConfigurationException occurs when the element describing the factory is malformed.
 * @see org.apache.felix.ipojo.ComponentFactory#check(org.apache.felix.ipojo.metadata.Element)
 */
public void check(Element metadata) throws ConfigurationException {
  String name = metadata.getAttribute("name");
  if (name == null) {
    throw new ConfigurationException("A composite needs a name : " + metadata);
  }
}

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

private void collectStructuralFields(List<String> fieldsInStructure, Element structure) {
  Element[] fields = structure.getElements("field");
  if (fields != null) {
    for (Element field : fields) {
      fieldsInStructure.add(field.getAttribute("name"));
    }
  }
}

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

private String computeFilter(Element dependencyElement, Dictionary filtersConfiguration, Dictionary fromConfiguration, boolean aggregate, String identity) {
  String filter = dependencyElement.getAttribute("filter");
  // Get instance filter if available
  if (filtersConfiguration != null && identity != null && filtersConfiguration.get(identity) != null) {
    filter = (String) filtersConfiguration.get(identity);
  }
  // Compute the 'from' attribute
  filter = updateFilterIfFromIsEnabled(fromConfiguration, dependencyElement, filter, aggregate, identity);
  return filter;
}

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

/**
 * Check if the metadata are well formed.
 * @param metadata : metadata
 * @throws ConfigurationException occurs when the element describing the factory is malformed.
 * @see org.apache.felix.ipojo.ComponentFactory#check(org.apache.felix.ipojo.metadata.Element)
 */
public void check(Element metadata) throws ConfigurationException {
  String name = metadata.getAttribute("name");
  if (name == null) {
    throw new ConfigurationException("A composite needs a name : " + metadata);
  }
}

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

/**
 * Returns the {@literal classname} attribute value.
 */
private String getComponentClassname() {
  return m_declaration.getComponentMetadata().getAttribute("classname");
}

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

private String computeFilter(Element dependencyElement, Dictionary filtersConfiguration, Dictionary fromConfiguration, boolean aggregate, String identity) {
  String filter = dependencyElement.getAttribute("filter");
  // Get instance filter if available
  if (filtersConfiguration != null && identity != null && filtersConfiguration.get(identity) != null) {
    filter = (String) filtersConfiguration.get(identity);
  }
  // Compute the 'from' attribute
  filter = updateFilterIfFromIsEnabled(fromConfiguration, dependencyElement, filter, aggregate, identity);
  return filter;
}

相关文章