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

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

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

  1. private String initComponentName() {
  2. String name = m_componentMetadata.getAttribute("name");
  3. if (name == null) {
  4. name = m_componentMetadata.getAttribute("classname");
  5. }
  6. return name;
  7. }

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

  1. /**
  2. * Creates a field metadata.
  3. * This constructor is used when creating the {@link PojoMetadata}
  4. * object.
  5. * @param metadata the field manipulation element from Manipulation
  6. * Metadata.
  7. */
  8. FieldMetadata(Element metadata) {
  9. m_name = metadata.getAttribute("name");
  10. m_type = metadata.getAttribute("type");
  11. }

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

  1. /**
  2. * Return the {@literal classname} attribute value.
  3. * @param meta metadata to be explored
  4. * @return the {@literal classname} attribute value or {@literal null} if
  5. * the attribute does not exists.
  6. */
  7. public static String getComponentType(Element meta) {
  8. return meta.getAttribute("classname");
  9. }

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

  1. /**
  2. * Creates a field metadata.
  3. * This constructor is used when creating the {@link PojoMetadata}
  4. * object.
  5. * @param metadata the field manipulation element from Manipulation
  6. * Metadata.
  7. */
  8. FieldMetadata(Element metadata) {
  9. m_name = metadata.getAttribute("name");
  10. m_type = metadata.getAttribute("type");
  11. }

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

  1. private String initComponentName() {
  2. String name = m_componentMetadata.getAttribute("name");
  3. if (name == null) {
  4. name = m_componentMetadata.getAttribute("classname");
  5. }
  6. return name;
  7. }

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

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

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

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

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

  1. private String getServiceSpecificationAttribute(Element dep) {
  2. String serviceSpecification = dep.getAttribute("interface");
  3. // the 'interface' attribute is deprecated
  4. if (serviceSpecification != null) {
  5. warn("The 'interface' attribute is deprecated, use the 'specification' attribute instead");
  6. } else {
  7. serviceSpecification = dep.getAttribute("specification");
  8. }
  9. return serviceSpecification;
  10. }

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

  1. /**
  2. * Returns the value of the attribute "name" of the namespace "ns".
  3. * @param name the name of the attribute to find
  4. * @param ns the namespace of the attribute to find
  5. * @return the String value of the attribute, or
  6. * <code>null</code> if the attribute is not found.
  7. */
  8. public String getAttribute(String name, String ns) {
  9. name = ns.toLowerCase() + ":" + name.toLowerCase();
  10. return getAttribute(name);
  11. }

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

  1. /**
  2. * Returns the value of the attribute "name" of the namespace "ns".
  3. * @param name the name of the attribute to find
  4. * @param ns the namespace of the attribute to find
  5. * @return the String value of the attribute, or
  6. * <code>null</code> if the attribute is not found.
  7. */
  8. public String getAttribute(String name, String ns) {
  9. name = ns.toLowerCase() + ":" + name.toLowerCase();
  10. return getAttribute(name);
  11. }

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

  1. private String getServiceSpecificationAttribute(Element dep) {
  2. String serviceSpecification = dep.getAttribute("interface");
  3. // the 'interface' attribute is deprecated
  4. if (serviceSpecification != null) {
  5. warn("The 'interface' attribute is deprecated, use the 'specification' attribute instead");
  6. } else {
  7. serviceSpecification = dep.getAttribute("specification");
  8. }
  9. return serviceSpecification;
  10. }

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

  1. private String initComponentVersion(BundleContext bundleContext) {
  2. String version = m_componentMetadata.getAttribute("version");
  3. if (version != null) {
  4. if ("bundle".equalsIgnoreCase(version)) {
  5. return bundleContext.getBundle().getHeaders().get(Constants.BUNDLE_VERSION);
  6. }
  7. }
  8. return version;
  9. }

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

  1. private String initComponentVersion(BundleContext bundleContext) {
  2. String version = m_componentMetadata.getAttribute("version");
  3. if (version != null) {
  4. if ("bundle".equalsIgnoreCase(version)) {
  5. return bundleContext.getBundle().getHeaders().get(Constants.BUNDLE_VERSION);
  6. }
  7. }
  8. return version;
  9. }

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

  1. /**
  2. * Returns the {@literal classname} attribute value.
  3. */
  4. private String getComponentClassname() {
  5. return m_declaration.getComponentMetadata().getAttribute("classname");
  6. }

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

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

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

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

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

  1. private String computeFilter(Element dependencyElement, Dictionary filtersConfiguration, Dictionary fromConfiguration, boolean aggregate, String identity) {
  2. String filter = dependencyElement.getAttribute("filter");
  3. // Get instance filter if available
  4. if (filtersConfiguration != null && identity != null && filtersConfiguration.get(identity) != null) {
  5. filter = (String) filtersConfiguration.get(identity);
  6. }
  7. // Compute the 'from' attribute
  8. filter = updateFilterIfFromIsEnabled(fromConfiguration, dependencyElement, filter, aggregate, identity);
  9. return filter;
  10. }

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

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

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

  1. /**
  2. * Returns the {@literal classname} attribute value.
  3. */
  4. private String getComponentClassname() {
  5. return m_declaration.getComponentMetadata().getAttribute("classname");
  6. }

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

  1. private String computeFilter(Element dependencyElement, Dictionary filtersConfiguration, Dictionary fromConfiguration, boolean aggregate, String identity) {
  2. String filter = dependencyElement.getAttribute("filter");
  3. // Get instance filter if available
  4. if (filtersConfiguration != null && identity != null && filtersConfiguration.get(identity) != null) {
  5. filter = (String) filtersConfiguration.get(identity);
  6. }
  7. // Compute the 'from' attribute
  8. filter = updateFilterIfFromIsEnabled(fromConfiguration, dependencyElement, filter, aggregate, identity);
  9. return filter;
  10. }

相关文章