org.joox.Match.attr()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(117)

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

Match.attr介绍

[英]Get an attribute from the first element in the set of matched elements, or null if the first element does not have that attribute.

jOOX is namespace-unaware. The supplied attribute name will be compared against all attributes, matching the first one that has the given name.
[中]从匹配元素集中的第一个元素获取属性,如果第一个元素没有该属性,则获取null
jOOX对此一无所知。提供的属性名称将与所有属性进行比较,并与第一个具有给定名称的属性相匹配。

代码示例

代码示例来源:origin: org.jooq/joox-java-6

@Override
  public String map(Context context) {
    return $(context).attr(attributeName);
  }
};

代码示例来源:origin: org.jooq/joox-java-6

@Override
  public boolean filter(Context context) {
    return set.contains($(context).attr("id"));
  }
};

代码示例来源:origin: org.jboss.windup.rules.apps/windup-rules-java-ee

@Override
  public boolean filter(Context context)
  {
    String name = $(context).attr("name");
    String idVal = $(context).attr("id");
    LOG.info("Matching: " + id + " Against -- ID: " + idVal + " Name: " + name);
    return (StringUtils.equals(id, idVal) || StringUtils.equals(id, name));
  }
};

代码示例来源:origin: org.jooq/joox-java-6

@Override
  public boolean filter(Context context) {
    String value = $(context).attr(name);
    if (value == null)
      return false;
    return pattern.matcher(value).matches();
  }
};

代码示例来源:origin: org.jboss.windup.rules.apps/windup-rules-java-ee

private String extractAttributeAndTrim(Element element, String property)
{
  String result = $(element).attr(property);
  return StringUtils.trimToNull(result);
}

代码示例来源:origin: org.jboss.windup.addon/config-impl

@Override
  public Condition processElement(ParserContext handlerManager, Element element)
  {
   return new ParamCondition($(element).attr("name"), $(element).attr("value"));
  }
}

代码示例来源:origin: org.jboss.windup.config/windup-config-xml

@Override
public NamespaceEntry processElement(ParserContext handlerManager, Element element)
{
  String prefix = $(element).attr("prefix");
  String namespaceURI = $(element).attr("uri");
  NamespaceEntry entry = new NamespaceEntry(prefix, namespaceURI);
  return entry;
}

代码示例来源:origin: org.jboss.windup.config/windup-config-xml

@Override
  public Condition processElement(ParserContext handlerManager, Element element)
  {
   return new ParamCondition($(element).attr("name"), $(element).attr("value"));
  }
}

代码示例来源:origin: windup/windup

@Override
public NamespaceEntry processElement(ParserContext handlerManager, Element element)
{
  String prefix = $(element).attr("prefix");
  String namespaceURI = $(element).attr("uri");
  NamespaceEntry entry = new NamespaceEntry(prefix, namespaceURI);
  return entry;
}

代码示例来源:origin: org.jboss.windup.rules.apps/rules-xml

@Override
  public XSLTParameter processElement(ParserContext handlerManager, Element element)
        throws ConfigurationException
  {
    String property = $(element).attr("property");
    String value = $(element).attr("value");
    XSLTParameter entry = new XSLTParameter(property, value);
    return entry;
  }
}

代码示例来源:origin: org.jboss.windup.rules/rules-impl

protected String extractAttributeAndTrim(Element element, String property)
{
  String result = $(element).attr(property);
  return StringUtils.trimToNull(result);
}

代码示例来源:origin: org.jboss.windup.addon/config-impl

@Override
  public Operation processElement(ParserContext handlerManager, Element element) throws ConfigurationException
  {
   String message = $(element).attr("message");
   return new LogOperation(message);
  }
}

代码示例来源:origin: org.jboss.windup.rules/rules-impl

protected String extractAttributeAndTrim(Element element, String property)
{
  String result = $(element).attr(property);
  return StringUtils.trimToNull(result);
}

代码示例来源:origin: org.jboss.windup.config/windup-config-xml

@Override
  public Operation processElement(ParserContext handlerManager, Element element) throws ConfigurationException
  {
    String message = $(element).attr("message");
    return Log.message(Level.INFO, message);
  }
}

代码示例来源:origin: org.jboss.windup.rules.apps/rules-java-ee

private String extractAttributeAndTrim(Element element, String property)
{
  String result = $(element).attr(property);
  return StringUtils.trimToNull(result);
}

代码示例来源:origin: windup/windup

@Override
  public TechnologyTagExists processElement(ParserContext handlerManager, Element element) throws ConfigurationException
  {
    String technologyTagPattern = $(element).attr(NAME);
    String in = $(element).attr("in");

    if (StringUtils.isBlank(technologyTagPattern))
    {
      throw new WindupException("Error, '" + ELEMENT_NAME + "' element must have a non-empty '" + NAME + "' attribute");
    }

    return TechnologyTagExists.withName(technologyTagPattern).in(in);
  }
}

代码示例来源:origin: org.jboss.windup.reporting/windup-reporting-impl

@Override
  public LineitemExists processElement(ParserContext handlerManager, Element element) throws ConfigurationException
  {
    String messagePattern = $(element).attr(MESSAGE);

    if (StringUtils.isBlank(messagePattern))
    {
      throw new WindupException("Error, '" + ELEMENT_NAME + "' element must have a non-empty '" + MESSAGE + "' attribute");
    }

    return LineitemExists.withMessage(messagePattern);
  }
}

代码示例来源:origin: org.jboss.windup.config/windup-config-xml

@Override
  public Void processElement(ParserContext context, Element element)
  {
   context.getWhere().matches($(element).attr("pattern"));
   return null;
  }
}

代码示例来源:origin: org.jboss.windup.addon/config-impl

@Override
  public Void processElement(ParserContext context, Element element)
  {
   context.getWhere().matches($(element).attr("pattern"));
   return null;
  }
}

代码示例来源:origin: org.jboss.windup.reporting/windup-reporting-impl

@Override
  public HasHint processElement(ParserContext handlerManager, Element element) throws ConfigurationException
  {
    String pattern = $(element).attr("message");
    HasHint hint = new HasHint();

    if (!Strings.isNullOrEmpty(pattern))
      hint.setMessagePattern(pattern);

    return hint;
  }
}

相关文章