code: @SuppressWarnings("checkstyle:npathcomplexity")
      public static JsonValue findValueWithPattern(NavigableJsonInputAdapter input,
                                                   JsonSchemaNode schemaNode, JsonPattern expectedPattern,
                                                   JsonPathCursor attributePath) throws IOException {
          for (int i = 0; i < expectedPattern.depth(); i++) {
              if (attributePath.getNext() == null) {
                  return null;
              }
              if (schemaNode.isTerminal()) {
                  return null;
              }
              int expectedOrderIndex = expectedPattern.get(i);
              JsonSchemaStructNode structDescription = (JsonSchemaStructNode) schemaNode;
              if (structDescription.getChildCount() <= expectedOrderIndex) {
                  return null;
              }
              JsonSchemaNameValue nameValue = structDescription.getChild(expectedOrderIndex);
              if (structMatches(input, nameValue, expectedOrderIndex, attributePath)) {
                  schemaNode = nameValue.getValue();
              } else {
                  return null;
              }
          }
          if (attributePath.getNext() == null) {
              if (schemaNode.isTerminal()) {
                  // at this point we are sure we found the value by pattern. So we have to be able to extract JsonValue.
                  // Otherwise, let the exceptions propagate
                  try {
                      JsonReducedValueParser valueParser = new JsonReducedValueParser();
                      int valuePos = ((JsonSchemaTerminalNode) schemaNode).getValueStartLocation();
                      return input.parseValue(valueParser, valuePos);
                  } catch (ParseException parseException) {
                      throw new HazelcastException(parseException);
                  }
              } else {
                  return NonTerminalJsonValue.INSTANCE;
              }
          }
          return null;
      }
docs: Extract the JsonValue that is stored in attributePath in input.
  This method validates expectedPattern using attributePath while
  extraction. If expectedPattern points to invalid or wrong attributes
  at any point, this method returns {@code null}
  
  NOTE: this method cannot handle patterns with "any" in it.
  
  @param input             a byte array containing the target object
  @param schemaNode        valid schema description to the target
  object. The behavior is undefined if
  description does not match the actual
  object
  @param expectedPattern   this cannot contain "any"
  @param attributePath     this cannot contain "any"
  @return                  JsonValue extracted or null