[ONOS-4931] fix doc of FlowEntry.life(), add life(TimeUnit)

Fix the doc: life() returns the time in seconds, not milliseconds.

Add new method life(TimeUnit) that allows specifying the timeunit to
receive the life value as as seconds might not be enough for
all applications and OpenFlow can provide this value to nanoseconds resolution
(in its spec).

Change-Id: Ia6a7573797249e0edc04e03c7204a550a2823742
diff --git a/core/api/src/main/java/org/onosproject/net/flow/DefaultTypedFlowEntry.java b/core/api/src/main/java/org/onosproject/net/flow/DefaultTypedFlowEntry.java
index 03ea3d7..31d394a 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/DefaultTypedFlowEntry.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/DefaultTypedFlowEntry.java
@@ -16,7 +16,10 @@
 
 package org.onosproject.net.flow;
 
+import java.util.concurrent.TimeUnit;
+
 import static com.google.common.base.MoreObjects.toStringHelper;
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
 
 /**
  * Default flow entry class with FlowLiveType value, IMMEDIATE_FLOW, SHORT_FLOW, MID_FLOW, LONG_FLOW.
@@ -25,6 +28,23 @@
     implements TypedStoredFlowEntry {
     private FlowLiveType liveType;
 
+
+    /**
+     * Creates a typed flow entry from flow rule and its statistics, with default flow live type(IMMEDIATE_FLOW).
+     *
+     * @param rule the flow rule
+     * @param state the flow state
+     * @param life the flow duration since creation
+     * @param lifeTimeUnit the time unit of life
+     * @param packets the flow packets count
+     * @param bytes the flow bytes count
+     */
+    public DefaultTypedFlowEntry(FlowRule rule, FlowEntryState state,
+                                 long life, TimeUnit lifeTimeUnit, long packets, long bytes) {
+        super(rule, state, life, lifeTimeUnit, packets, bytes);
+        this.liveType = FlowLiveType.IMMEDIATE_FLOW;
+    }
+
     /**
      * Creates a typed flow entry from flow rule and its statistics, with default flow live type(IMMEDIATE_FLOW).
      *
@@ -59,7 +79,7 @@
      *
      */
     public DefaultTypedFlowEntry(FlowEntry fe) {
-        super(fe, fe.state(), fe.life(), fe.packets(), fe.bytes());
+        super(fe, fe.state(), fe.life(NANOSECONDS), NANOSECONDS, fe.packets(), fe.bytes());
         this.liveType = FlowLiveType.IMMEDIATE_FLOW;
     }
 
@@ -83,7 +103,7 @@
      *
      */
     public DefaultTypedFlowEntry(FlowEntry fe,  FlowLiveType liveType) {
-        super(fe, fe.state(), fe.life(), fe.packets(), fe.bytes());
+        super(fe, fe.state(), fe.life(NANOSECONDS), NANOSECONDS, fe.packets(), fe.bytes());
         this.liveType = liveType;
     }