public boolean parse(final String s) {
        if (StringUtils.isEmpty(s) || StringUtils.isBlank(s)) {
            return false;
        }

        final String[] tmps = Utils.parsePeerId(s);
        if (tmps.length < 2 || tmps.length > 4) {
            return false;
        }
        try {
            final int port = Integer.parseInt(tmps[1]);
            this.endpoint = new Endpoint(tmps[0], port);

            switch (tmps.length) {
                case 3:
                    this.idx = Integer.parseInt(tmps[2]);
                    break;
                case 4:
                    if (tmps[2].equals("")) {
                        this.idx = 0;
                    } else {
                        this.idx = Integer.parseInt(tmps[2]);
                    }
                    this.priority = Integer.parseInt(tmps[3]);
                    break;
                default:
                    break;
            }
            this.str = null;
            return true;
        } catch (final Exception e) {
            LOG.error("Parse peer from string failed: {}.", s, e);
            return false;
        }
    }
Parse peerId from string that generated by {@link #toString()}
This method can support parameter string values are below:

<pre>
PeerId.parse("a:b")          = new PeerId("a", "b", 0 , -1)
PeerId.parse("a:b:c")        = new PeerId("a", "b", "c", -1)
PeerId.parse("a:b::d")       = new PeerId("a", "b", 0, "d")
PeerId.parse("a:b:c:d")      = new PeerId("a", "b", "c", "d")
</pre>
jraft-core/src/main/java/com/alipay/sofa/jraft/entity/PeerId.java