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

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

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

  1. /**
  2. * Find all the values of the specified attribute in the given element.
  3. * @param metadata Element to be traversed
  4. * @param attributeName Search attribute name
  5. * @return Set of attribute values (no duplicate).
  6. */
  7. public static Set<String> findAttributes(Element metadata, String attributeName) {
  8. Set<String> referred = new HashSet<String>();
  9. // Search in the given element
  10. if (metadata.containsAttribute(attributeName)) {
  11. referred.add(metadata.getAttribute(attributeName));
  12. }
  13. // Search in children
  14. for (Element elem : metadata.getElements()) {
  15. Set<String> found = findAttributes(elem, attributeName);
  16. referred.addAll(found);
  17. }
  18. // Return all found values
  19. return referred;
  20. }

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

  1. private void addCallbacksToDependency(Element dependencyElement, Dependency dep) throws ConfigurationException {
  2. Element[] cbs = dependencyElement.getElements("Callback");
  3. for (int j = 0; cbs != null && j < cbs.length; j++) {
  4. if (!cbs[j].containsAttribute("method") || !cbs[j].containsAttribute("type")) {
  5. throw new ConfigurationException("Requirement Callback : a dependency callback must contain a method " +
  6. "and a type (bind or unbind) attribute");
  7. }
  8. String method = cbs[j].getAttribute("method");
  9. String type = cbs[j].getAttribute("type");
  10. int methodType = DependencyCallback.UNBIND;
  11. if ("bind".equalsIgnoreCase(type)) {
  12. methodType = DependencyCallback.BIND;
  13. } else if ("modified".equalsIgnoreCase(type)) {
  14. methodType = DependencyCallback.MODIFIED;
  15. }
  16. dep.addDependencyCallback(createDependencyHandler(dep, method, methodType));
  17. }
  18. }

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

  1. private void addCallbacksToDependency(Element dependencyElement, Dependency dep) throws ConfigurationException {
  2. Element[] cbs = dependencyElement.getElements("Callback");
  3. for (int j = 0; cbs != null && j < cbs.length; j++) {
  4. if (!cbs[j].containsAttribute("method") || !cbs[j].containsAttribute("type")) {
  5. throw new ConfigurationException("Requirement Callback : a dependency callback must contain a method " +
  6. "and a type (bind or unbind) attribute");
  7. }
  8. String method = cbs[j].getAttribute("method");
  9. String type = cbs[j].getAttribute("type");
  10. int methodType = DependencyCallback.UNBIND;
  11. if ("bind".equalsIgnoreCase(type)) {
  12. methodType = DependencyCallback.BIND;
  13. } else if ("modified".equalsIgnoreCase(type)) {
  14. methodType = DependencyCallback.MODIFIED;
  15. }
  16. dep.addDependencyCallback(createDependencyHandler(dep, method, methodType));
  17. }
  18. }

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

  1. if (publisher.containsAttribute(NAME_ATTRIBUTE)) {
  2. m_name = publisher.getAttribute(NAME_ATTRIBUTE);
  3. } else {
  4. if (publisher.containsAttribute(FIELD_ATTRIBUTE)) {
  5. m_field = publisher.getAttribute(FIELD_ATTRIBUTE);
  6. } else {
  7. if (publisher.containsAttribute(TOPICS_ATTRIBUTE)) {
  8. setTopics(publisher.getAttribute(TOPICS_ATTRIBUTE));
  9. } else {
  10. if (publisher.containsAttribute(SYNCHRONOUS_ATTRIBUTE)) {
  11. m_synchronous = "true".equalsIgnoreCase(publisher
  12. .getAttribute(SYNCHRONOUS_ATTRIBUTE));
  13. if (publisher.containsAttribute(DATA_KEY_ATTRIBUTE)) {
  14. m_dataKey = publisher.getAttribute(DATA_KEY_ATTRIBUTE);
  15. } else if (publisher.containsAttribute("data_key")) {
  16. } else if (publisher.containsAttribute("dataKey")) {

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

  1. if (publisher.containsAttribute(NAME_ATTRIBUTE)) {
  2. m_name = publisher.getAttribute(NAME_ATTRIBUTE);
  3. } else {
  4. if (publisher.containsAttribute(FIELD_ATTRIBUTE)) {
  5. m_field = publisher.getAttribute(FIELD_ATTRIBUTE);
  6. } else {
  7. if (publisher.containsAttribute(TOPICS_ATTRIBUTE)) {
  8. setTopics(publisher.getAttribute(TOPICS_ATTRIBUTE));
  9. } else {
  10. if (publisher.containsAttribute(SYNCHRONOUS_ATTRIBUTE)) {
  11. m_synchronous = "true".equalsIgnoreCase(publisher
  12. .getAttribute(SYNCHRONOUS_ATTRIBUTE));
  13. if (publisher.containsAttribute(DATA_KEY_ATTRIBUTE)) {
  14. m_dataKey = publisher.getAttribute(DATA_KEY_ATTRIBUTE);
  15. } else if (publisher.containsAttribute("data_key")) {
  16. } else if (publisher.containsAttribute("dataKey")) {

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

  1. if (subscriber.containsAttribute(NAME_ATTRIBUTE)) {
  2. m_name = subscriber.getAttribute(NAME_ATTRIBUTE);
  3. } else {
  4. if (subscriber.containsAttribute(CALLBACK_ATTRIBUTE)) {
  5. m_callback = subscriber.getAttribute(CALLBACK_ATTRIBUTE);
  6. } else if (subscriber.containsAttribute("method")) {
  7. m_callback = subscriber.getAttribute("method");
  8. } else {
  9. if (subscriber.containsAttribute(TOPICS_ATTRIBUTE)) {
  10. setTopics(subscriber.getAttribute(TOPICS_ATTRIBUTE));
  11. } else {
  12. if (subscriber.containsAttribute(FILTER_ATTRIBUTE)) {
  13. setFilter(subscriber.getAttribute(FILTER_ATTRIBUTE));

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

  1. if (subscriber.containsAttribute(NAME_ATTRIBUTE)) {
  2. m_name = subscriber.getAttribute(NAME_ATTRIBUTE);
  3. } else {
  4. if (subscriber.containsAttribute(CALLBACK_ATTRIBUTE)) {
  5. m_callback = subscriber.getAttribute(CALLBACK_ATTRIBUTE);
  6. } else if (subscriber.containsAttribute("method")) {
  7. m_callback = subscriber.getAttribute("method");
  8. } else {
  9. if (subscriber.containsAttribute(TOPICS_ATTRIBUTE)) {
  10. setTopics(subscriber.getAttribute(TOPICS_ATTRIBUTE));
  11. } else {
  12. if (subscriber.containsAttribute(FILTER_ATTRIBUTE)) {
  13. setFilter(subscriber.getAttribute(FILTER_ATTRIBUTE));

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

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

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

  1. String field = attribute.getAttribute(JMX_FIELD_ELT);
  2. if (attribute.containsAttribute(JMX_NAME_ELT)) {
  3. name = attribute.getAttribute(JMX_NAME_ELT);
  4. } else {
  5. name = field;
  6. if (attribute.containsAttribute(JMX_RIGHTS_ELT)) {
  7. rights = attribute.getAttribute(JMX_RIGHTS_ELT);
  8. } else {
  9. getTypeFromAttributeField(field, manipulation));
  10. if (attribute.containsAttribute(JMX_NOTIFICATION_ELT)) {
  11. notif = Boolean.parseBoolean(attribute
  12. .getAttribute(JMX_NOTIFICATION_ELT));
  13. if (method.containsAttribute(JMX_DESCRIPTION_ELT)) {
  14. description = method.getAttribute(JMX_DESCRIPTION_ELT);

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

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

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

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

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

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

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

  1. BundleContext bc = getBundleContextForConfiguration(element);
  2. if (element.containsAttribute("constructor-parameter")) {
  3. String idx = element.getAttribute("constructor-parameter");
  4. int index = Integer.parseInt(idx);
  5. } else if (element.containsAttribute("field")) {
  6. String field = element.getAttribute("field");
  7. final BundleContext injected = bc;
  8. } else if (element.containsAttribute("method")) {
  9. String method = element.getAttribute("method");
  10. MethodMetadata mm = getFactory().getPojoMetadata().getMethod(method,

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

  1. BundleContext bc = getBundleContextForConfiguration(element);
  2. if (element.containsAttribute("constructor-parameter")) {
  3. String idx = element.getAttribute("constructor-parameter");
  4. int index = Integer.parseInt(idx);
  5. } else if (element.containsAttribute("field")) {
  6. String field = element.getAttribute("field");
  7. final BundleContext injected = bc;
  8. } else if (element.containsAttribute("method")) {
  9. String method = element.getAttribute("method");
  10. MethodMetadata mm = getFactory().getPojoMetadata().getMethod(method,

相关文章