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

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

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

Match.text介绍

[英]Get the text content of the first element in the set of matched elements, or null if there are no matched elements.

This is the same as calling text(0)
[中]获取匹配元素集中第一个元素的文本内容,如果没有匹配的元素,则获取null
这与呼叫text(0)相同

代码示例

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

@Override
  public boolean filter(Context context) {
    return pattern.matcher($(context).text()).matches();
  }
};

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

@Override
  public TypeReferenceLocation processElement(ParserContext handlerManager, Element element)
        throws ConfigurationException
  {
    String location = $(element).text();
    if (StringUtils.isBlank(location))
    {
      throw new WindupException("Error, 'location' element must have non-empty contents");
    }

    return Enum.valueOf(TypeReferenceLocation.class, location.trim());
  }
}

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

@Override
  public TypeReferenceLocation processElement(ParserContext handlerManager, Element element)
        throws ConfigurationException
  {
    String location = $(element).text();
    if (StringUtils.isBlank(location))
    {
      throw new WindupException("Error, 'location' element must have non-empty contents");
    }

    return Enum.valueOf(TypeReferenceLocation.class, location.trim());
  }
}

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

@Override
  public TypeReferenceLocation processElement(ParserContext handlerManager, Element element)
        throws ConfigurationException
  {
    String location = $(element).text();
    if (StringUtils.isBlank(location))
    {
      throw new WindupException("Error, 'location' element must have non-empty contents");
    }

    return Enum.valueOf(TypeReferenceLocation.class, location.trim());
  }
}

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

@Override
  public String processElement(ParserContext handlerManager, Element element) throws ConfigurationException
  {
    String message = $(element).text();
    if (StringUtils.isBlank(message))
    {
      throw new WindupException("Error, 'message' element must not be blank");
    }
    return message;
  }
}

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

@Override
  public String processElement(ParserContext handlerManager, Element element) throws ConfigurationException
  {
    String message = $(element).text();
    if (StringUtils.isBlank(message))
    {
      throw new WindupException("Error, 'message' element must not be blank");
    }
    return message;
  }
}

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

private Map<String, Integer> parseTxTimeout(Element enterpriseBeanTag, String ejbName)
  {
    Map<String, Integer> transactionTimeouts = new HashMap<>();
    String transactionTimeoutSeconds = $(enterpriseBeanTag).child("transaction-descriptor").child("trans-timeout-seconds").text();
    String methodName = "*";
    if (StringUtils.isNotBlank(transactionTimeoutSeconds))
    {
      try
      {
        Integer txTimeout = Integer.parseInt(transactionTimeoutSeconds);
        transactionTimeouts.put(methodName, txTimeout);
      }
      catch (Exception e)
      {
        LOG.info("EJB: " + ejbName + " contains bad reference to TX Timeout on Method: " + methodName);
      }
    }

    return transactionTimeouts;
  }
}

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

private Map<String, Integer> parseTxTimeout(Element enterpriseBeanTag, String ejbName)
  {
    Map<String, Integer> transactionTimeouts = new HashMap<>();
    String transactionTimeoutSeconds = $(enterpriseBeanTag).child("transaction-descriptor").child("trans-timeout-seconds").text();
    String methodName = "*";
    if (StringUtils.isNotBlank(transactionTimeoutSeconds))
    {
      try
      {
        Integer txTimeout = Integer.parseInt(transactionTimeoutSeconds);
        transactionTimeouts.put(methodName, txTimeout);
      }
      catch (Exception e)
      {
        LOG.info("EJB: " + ejbName + " contains bad reference to TX Timeout on Method: " + methodName);
      }
    }

    return transactionTimeouts;
  }
}

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

private String extractChildTagAndTrim(Element element, String property)
  {
    String result = $(element).find(property).first().text();
    return StringUtils.trimToNull(result);
  }
}

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

private String extractChildTagAndTrim(Element element, String property)
  {
    String result = $(element).find(property).first().text();
    return StringUtils.trimToNull(result);
  }
}

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

protected List<EnvironmentReference> processEnvironmentReference(Element element)
{
  List<EnvironmentReference> resources = new LinkedList<EnvironmentReference>();
  // find JMS references...
  List<Element> queueReferences = $(element).find("resource-env-ref").get();
  for (Element e : queueReferences)
  {
    String type = $(e).child("resource-env-ref-type").text();
    String name = $(e).child("resource-env-ref-name").text();
    type = StringUtils.trim(type);
    name = StringUtils.trim(name);
    EnvironmentReference ref = envRefDao.createEnvironmentReference(name, type);
    LOG.info("Adding name: " + name + ", type: " + type);
    resources.add(ref);
  }
  return resources;
}

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

private void processBinding(EnvironmentReferenceService envRefService, JNDIResourceService jndiResourceService, Set<ProjectModel> applications,
      Element resourceRef, String tagName, String tagJndi)
{
  String jndiLocation = $(resourceRef).child(tagJndi).text();
  String resourceRefName = $(resourceRef).child(tagName).text();
  if (StringUtils.isNotBlank(jndiLocation) && StringUtils.isNotBlank(resourceRefName))
  {
    JNDIResourceModel resource = jndiResourceService.createUnique(applications, jndiLocation);
    LOG.info("JNDI Name: " + jndiLocation + " to Resource: " + resourceRefName);
    // now, look up the resource which is resolved by DiscoverEjbConfigurationXmlRuleProvider
    for (EnvironmentReferenceModel ref : envRefService.findAllByProperty(EnvironmentReferenceModel.NAME, resourceRefName))
    {
      envRefService.associateEnvironmentToJndi(resource, ref);
    }
  }
}

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

private void processBinding(EnvironmentReferenceService envRefService, JNDIResourceService jndiResourceService, Set<ProjectModel> applications,
      Element resourceRef, String tagName, String tagJndi)
{
  String jndiLocation = $(resourceRef).child(tagJndi).text();
  String resourceRefName = $(resourceRef).child(tagName).text();
  if (StringUtils.isNotBlank(jndiLocation) && StringUtils.isNotBlank(resourceRefName))
  {
    JNDIResourceModel resource = jndiResourceService.createUnique(applications, jndiLocation);
    LOG.info("JNDI Name: " + jndiLocation + " to Resource: " + resourceRefName);
    // now, look up the resource which is resolved by DiscoverEjbConfigurationXmlRuleProvider
    for (EnvironmentReferenceModel ref : envRefService.findAllByProperty(EnvironmentReferenceModel.NAME, resourceRefName))
    {
      envRefService.associateEnvironmentToJndi(resource, ref);
    }
  }
}

代码示例来源:origin: io.teecube.t3/t3-common

public static List<Lifecycle<Phase>> parse(File componentsFile, MavenProject project, MavenSession session) throws SAXException, IOException {
  List<Lifecycle<Phase>> lifecycles = new ArrayList<Lifecycle<Phase>>();
  Match lifecyclesElements;
  lifecyclesElements = JOOX.$(componentsFile).xpath("//component[implementation='org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping']");
  for (Element element : lifecyclesElements) {
    List<Phase> phases = new ArrayList<Phase>();
    Match phasesElements = JOOX.$(element).xpath("configuration/phases/*");
    for (Element phase : phasesElements) {
      phases.add(new Phase(phase.getNodeName(), phase.getTextContent(), project, session));
    }
    lifecycles.add(new Lifecycle<Phase>(JOOX.$(element).xpath("role-hint").text(), phases));
  }
  return lifecycles;
}

代码示例来源:origin: io.teecube.t3/t3-site-enhancer

private List<Lifecycle> parseLifecycles(File componentsFile) throws SAXException, IOException {
  List<Lifecycle> lifecycles = new ArrayList<GenerateLifecyclesDocMojo.Lifecycle>();
  Match lifecyclesElements;
  lifecyclesElements = JOOX.$(componentsFile).xpath("//component[implementation='org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping']");
  for (Element element : lifecyclesElements) {
    List<Phase> phases = new ArrayList<GenerateLifecyclesDocMojo.Phase>();
    Match phasesElements = JOOX.$(element).xpath("configuration/phases/*");
    for (Element phase : phasesElements) {
      phases.add(new Phase(phase.getNodeName(), phase.getTextContent(), project, session));
    }
    lifecycles.add(new Lifecycle(JOOX.$(element).xpath("role-hint").text(), phases));
  }
  return lifecycles;
}

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

protected String extractChildTagAndTrim(Element element, String property)
  {
    String result = $(element).find(property).first().text();
    return StringUtils.trimToNull(result);
  }
}

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

private String extractChildTagAndTrim(Element element, String property)
  {
    String result = $(element).find(property).first().text();
    return StringUtils.trimToNull(result);
  }
}

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

protected List<EnvironmentReference> processEnvironmentReference(Element element)
{
  List<EnvironmentReference> resources = new LinkedList<EnvironmentReference>();
  // find JMS references...
  List<Element> queueReferences = $(element).find("resource-ref").get();
  for (Element e : queueReferences)
  {
    String id = $(e).attr("id");
    String type = $(e).child("res-type").text();
    String name = $(e).child("res-ref-name").text();
    type = StringUtils.trim(type);
    name = StringUtils.trim(name);
    EnvironmentReference ref = envRefDao.createEnvironmentReference(name, type);
    ref.setReferenceId(id);
    resources.add(ref);
  }
  return resources;
}

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

protected String extractChildTagAndTrim(Element element, String property)
  {
    String result = $(element).find(property).first().text();
    return StringUtils.trimToNull(result);
  }
}

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

private List<EnvironmentReferenceModel> processEnvironmentReference(GraphContext context, Element element)
{
  EnvironmentReferenceService environmentReferenceService = new EnvironmentReferenceService(context);
  List<EnvironmentReferenceModel> resources = new LinkedList<EnvironmentReferenceModel>();
  // find JMS references...
  List<Element> queueReferences = $(element).find("resource-env-ref").get();
  for (Element e : queueReferences)
  {
    String type = $(e).child("resource-env-ref-type").text();
    String name = $(e).child("resource-env-ref-name").text();
    type = StringUtils.trim(type);
    name = StringUtils.trim(name);
    EnvironmentReferenceModel ref = environmentReferenceService.findEnvironmentReference(name, type);
    if (ref == null)
    {
      ref = environmentReferenceService.create();
      ref.setName(name);
      ref.setReferenceType(type);
    }
    resources.add(ref);
  }
  return resources;
}

相关文章