public class DataPathInfoCodec extends AbstractJsonCodec<DataPathInfo>
DataPathInfo
. Requires PortCodec
as a
pre-requisite.log, mapper, NO_DECODING_SUP, root, roots
Modifier | Constructor and Description |
---|---|
protected |
DataPathInfoCodec()
Constructs a DataPathInfo Codec.
|
Modifier and Type | Method and Description |
---|---|
DataPathInfo |
decode(com.fasterxml.jackson.databind.node.ObjectNode node)
Decodes the JSON into a typed POJO.
|
com.fasterxml.jackson.databind.node.ObjectNode |
encode(DataPathInfo dpi)
Encodes the given POJO to its JSON representation.
|
protected DataPathId |
getDpid(com.fasterxml.jackson.databind.node.ObjectNode node,
String key)
Reads the property with the given key from the given object node and
attempts to interpret it as a datapath identifier.
|
protected int |
getIntOrZero(com.fasterxml.jackson.databind.node.ObjectNode node,
String key)
Returns the property with the given key from the given object node,
interpreted as an int value.
|
protected IpAddress |
getIp(com.fasterxml.jackson.databind.node.ObjectNode node,
String key)
Returns the property with the given key from the given object node,
interpreted as an IP address.
|
protected long |
getLongOrZero(com.fasterxml.jackson.databind.node.ObjectNode node,
String key)
Returns the property with the given key from the given object node,
interpreted as a long value.
|
protected PortNumber |
getPortNumber(com.fasterxml.jackson.databind.node.ObjectNode node,
String key)
Returns the property with the given key from the given object node,
interpreted as a TCP port number.
|
protected ProtocolVersion |
getPv(com.fasterxml.jackson.databind.node.ObjectNode node,
String key)
Reads the property with the given key from the given object node and
attempts to interpret it as an OpenFlow protocol version.
|
protected String |
getText(com.fasterxml.jackson.databind.node.ObjectNode node,
String key)
Returns the
JsonNode.textValue() of a property on the given
object node for the given key. |
protected long |
getTime(com.fasterxml.jackson.databind.node.ObjectNode node,
String key)
Reads the property with the given key from the given object node and
attempts to interpret it as an RFC822 timestamp, returning a value
representing the number of milliseconds since
January 1, 1970, 00:00:00 GMT.
|
arrayNode, decode, decodeList, encode, encodeIterator, encodeIterator, encodeList, encodeList, fromEnums, isMissingContent, longVal, objectNode, read, root, roots, toEnums, write
public com.fasterxml.jackson.databind.node.ObjectNode encode(DataPathInfo dpi)
JsonCodec
dpi
- POJO to encodeprotected String getText(com.fasterxml.jackson.databind.node.ObjectNode node, String key)
JsonNode.textValue()
of a property on the given
object node for the given key. If the property does not exist, an
empty string is returned.node
- the object nodekey
- the property keyprotected long getTime(com.fasterxml.jackson.databind.node.ObjectNode node, String key)
node
- the object nodekey
- the property keyIllegalArgumentException
- if the value is not correctly formattedDate.getTime()
protected ProtocolVersion getPv(com.fasterxml.jackson.databind.node.ObjectNode node, String key)
node
- the object nodekey
- the property keyIllegalArgumentException
- if the value is not recognizedprotected DataPathId getDpid(com.fasterxml.jackson.databind.node.ObjectNode node, String key)
node
- the object nodekey
- the property keyIllegalArgumentException
- if the value is malformedprotected long getLongOrZero(com.fasterxml.jackson.databind.node.ObjectNode node, String key)
node
- the object nodekey
- the property keyprotected int getIntOrZero(com.fasterxml.jackson.databind.node.ObjectNode node, String key)
node
- the object nodekey
- the property keyprotected IpAddress getIp(com.fasterxml.jackson.databind.node.ObjectNode node, String key)
node
- the object nodekey
- the property keyIllegalArgumentException
- if the value is malformedprotected PortNumber getPortNumber(com.fasterxml.jackson.databind.node.ObjectNode node, String key)
node
- the object nodekey
- the property keyIllegalArgumentException
- if the value is not validpublic DataPathInfo decode(com.fasterxml.jackson.databind.node.ObjectNode node)
JsonCodec
node
- JSON representation of the typed POJO. This does not have a
"top" rootCopyright © 2015. All Rights Reserved.