code: public static MessageNode buildMessageNode(MessagePattern pattern) {
          int limit = pattern.countParts() - 1;
          if (limit < 0) {
              throw new IllegalArgumentException("The MessagePattern is empty");
          } else if (pattern.getPartType(0) != MessagePattern.Part.Type.MSG_START) {
              throw new IllegalArgumentException(
              "The MessagePattern does not represent a MessageFormat pattern");
          }
          return buildMessageNode(pattern, 0, limit);
      }
docs: Factory method, builds and returns a MessageNode from a MessagePattern.
  @param pattern a parsed MessageFormat pattern string
  @return a MessageNode or a ComplexArgStyleNode
  @throws IllegalArgumentException if the MessagePattern is empty
  or does not represent a MessageFormat pattern