java.lang.Object
com.hedera.hashgraph.sdk.MirrorNodeRestPath
A path below a mirror node's REST base URL.
The type is the mechanism: no mirror node REST call site can name a foreign host, because the only
way to reach MirrorNodeHttpClient is through this type and this type cannot express one.
Nothing downstream has to check.
Resolution against the base URL is plain concatenation. Every URL-reference resolver in the JDK —
URI.resolve included — lets an absolute or protocol-relative reference replace the host
outright, which is exactly the failure this type exists to prevent.
-
Method Summary
Modifier and TypeMethodDescription(package private) static MirrorNodeRestPathfromNextLink(String link) Convert a mirror nodelinks.nextcursor into a path.(package private) StringgetValue()Extract the path.(package private) static MirrorNodeRestPathBuild a path.(package private) StringresolveAgainst(String baseUrl) Resolve against a mirror node REST base URL by concatenation.toString()
-
Method Details
-
of
Build a path.- Parameters:
path- a path beginning with/, with no host, no protocol-relative prefix and no..segment- Returns:
- the new path
- Throws:
IllegalArgumentException- if the path could name somewhere other than the mirror node
-
fromNextLink
Convert a mirror nodelinks.nextcursor into a path.The mirror node includes the
/api/v1prefix that the base URL already carries, so it is stripped exactly once.- Parameters:
link- thelinks.nextvalue- Returns:
- the new path
- Throws:
IllegalArgumentException- if the cursor names a host
-
getValue
String getValue()Extract the path.- Returns:
- the path, beginning with
/
-
resolveAgainst
Resolve against a mirror node REST base URL by concatenation.- Parameters:
baseUrl- the base URL, with or without a trailing slash- Returns:
- the absolute URL
-
toString
-