Class ValueResolver

java.lang.Object
io.jenkins.plugins.restlistparam.logic.ValueResolver

public class ValueResolver extends Object
  • Method Details

    • resolveXPath

      public static ResultContainer<List<ValueItem>> resolveXPath(String xmlStr, String expression, String displayExpression)
      Parses a xmlStr, applies a xPath expression and returns a list of strings based on the result
      Parameters:
      xmlStr - The XML text as string
      expression - The xPath expression
      displayExpression - The xPath expression
      Returns:
      A ResultContainer capsuling either a list of strings or a user-friendly error message
    • resolveJsonPath

      public static ResultContainer<List<ValueItem>> resolveJsonPath(String jsonStr, String expression, String displayExpression)
      Parses a jsonStr, applies a Json-Path expression and returns a list of strings based on the result
      Parameters:
      jsonStr - The Json text as string
      expression - The Json-Path expression
      displayExpression - The Json-Path expression
      Returns:
      A ResultContainer capsuling either a list of strings or a user-friendly error message
    • convertToString

      public static String convertToString(Object obj)
    • parseDisplayValue

      public static String parseDisplayValue(MimeType mime, String valueStr, String displayExpression)
      Apply the display expression filter on a given value (only JSON supported).
      Parameters:
      mime - The MimeType of the value to pars for the display value.
      valueStr - The value the display value should be parsed from.
      displayExpression - The display expression to filter for the display value in valueStr.
      Returns:
      Returns the display value.