Class QueryNetwork
java.lang.Object
org.libxmq.Query
org.libxmq.QueryNetwork
Implements network related queries, url:s, hostnames, ip-addresses etc.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringRetrieve a fully qualified domain name, such as mail.mydomain.com.static StringgetHostname(String xpath) Retrieve a host name, such as mail or gateway or mycomputer.static InetAddressgetInetAddress(String xpath) Retrieve an internet address ipv4 or ipv6.static URLRetrieve an URL, such as https://foo.bar.com?Methods inherited from class Query
element, expect, forEach, getBoolean, getDouble, getFloat, getInt, getLong, getOptionalBoolean, getOptionalDouble, getOptionalFloat, getOptionalInt, getOptionalLong, getOptionalString, getString, node, optionalElement, query, selectModifier and TypeMethodDescriptionFetches a single element from the xpath.voidexpect(String xpath, NodeCallback cb) Perform a single callback for a single node matching the xpath expression.intforEach(String xpath, NodeCallback cb) Perform a callback for each node matching the xpath expression.booleangetBoolean(String xpath) Get a boolean from an xpath location.doubleGet a 64 bit IEEE double floating point value from an xpath location and check that it complies with the restrictions.floatGet a 32 bit IEEE double floating point value from an xpath location and check that it complies with the restrictions.intGet a 32 bit signed integer from an xpath location and check that it complies with the restriction.longGet a 64 bit signed integer from an xpath location that complies with any restriction.getOptionalBoolean(String xpath) Get an optional boolean from an xpath location.getOptionalDouble(String xpath, String restriction) Get an optional 64 bit IEEE double floating point value from an xpath location and check that it complies with the restrictions.getOptionalFloat(String xpath, String restriction) Get an optional 32 bit IEEE double floating point value from an xpath location and check that it complies with the restrictions.getOptionalInt(String xpath, String restriction) Get an optional 32 bit signed integer from an xpath location and check that it complies with the restriction.getOptionalLong(String xpath, String restriction) Get an optional 64 bit signed integer from an xpath location that complies with any restriction.getOptionalString(String xpath, String restriction) Get an optional string from an xpath location that complies with a restriction.Get a string from an xpath location that complies with a restriction.node()Return the node from which the query starts.optionalElement(String xpath) Fetches a single optional element from the xpath.Fetches a single element and wraps it inside a query from the xpath.Select the nodes matching the xpath expression, evaluated from the query node.
-
Constructor Details
-
QueryNetwork
Build a new query from a DOM node.- Parameters:
node- The DOM node from which the paths start when querying.
-
-
Method Details
-
getInetAddress
public static InetAddress getInetAddress(String xpath) throws DecodingException, NotFoundException, TooManyException Retrieve an internet address ipv4 or ipv6.- Parameters:
xpath- Fetch the value found using this xpath.- Returns:
- The iternet address.
- Throws:
NotFoundException- if the expected xpath was not found.DecodingException- if the value was not an integer or if it failed the restriction.TooManyException- if more than one element matched the xpath.
-
getHostname
public static String getHostname(String xpath) throws NotFoundException, DecodingException, TooManyException Retrieve a host name, such as mail or gateway or mycomputer.- Parameters:
xpath- Use this xpath to find the host name.- Returns:
- The hostname.
- Throws:
NotFoundException- if the expected xpath was not found.DecodingException- if the value was not an integer or if it failed the restriction.TooManyException- if more than one element matched the xpath.
-
getFQDN
public static String getFQDN(String xpath) throws NotFoundException, DecodingException, TooManyException Retrieve a fully qualified domain name, such as mail.mydomain.com.- Parameters:
xpath- Use this xpath to find the host name.- Returns:
- The fqdn.
- Throws:
NotFoundException- if the expected xpath was not found.DecodingException- if the value was not an integer or if it failed the restriction.TooManyException- if more than one element matched the xpath.
-
getURL
public static URL getURL(String xpath) throws NotFoundException, DecodingException, TooManyException Retrieve an URL, such as https://foo.bar.com?a=123- Parameters:
xpath- Use this xpath to find the host name.- Returns:
- The url address.
- Throws:
NotFoundException- if the expected xpath was not found.DecodingException- if the value was not an integer or if it failed the restriction.TooManyException- if more than one element matched the xpath.
-