diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2022-01-30 14:10:47 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-11-12 23:49:55 +0100 |
commit | ebec82011e1f83bd40f5bb94ea72c2552306e940 (patch) | |
tree | b82b2fdd2d2300c067aaa0c76451baadc3cb6907 /src/main/java/com/lumaserv/bgp/protocol/attribute/ASPathAttribute.java | |
parent | e3f9330af263fba206c5901a5a23a26b9da52142 (diff) |
Implement toString in various path attributes
Diffstat (limited to 'src/main/java/com/lumaserv/bgp/protocol/attribute/ASPathAttribute.java')
-rw-r--r-- | src/main/java/com/lumaserv/bgp/protocol/attribute/ASPathAttribute.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/java/com/lumaserv/bgp/protocol/attribute/ASPathAttribute.java b/src/main/java/com/lumaserv/bgp/protocol/attribute/ASPathAttribute.java index d6f14ea..6405924 100644 --- a/src/main/java/com/lumaserv/bgp/protocol/attribute/ASPathAttribute.java +++ b/src/main/java/com/lumaserv/bgp/protocol/attribute/ASPathAttribute.java @@ -37,6 +37,31 @@ public class ASPathAttribute implements PathAttribute { public static class Segment { byte type; List<Integer> asns = new ArrayList<>(); + + public String toString() { + StringBuffer buf = new StringBuffer(); + + buf.append("("); + for(Integer asn : asns) { + if (buf.length() > 1) + buf.append(" "); + buf.append(asn); + } + buf.append(")"); + return buf.toString(); + } } + public String toString() { + StringBuffer buf = new StringBuffer(); + + buf.append("["); + for(Segment segment : segments) { + if (buf.length() > 1) + buf.append(", "); + buf.append(segment); + } + buf.append("]"); + return buf.toString(); + } } |