Class RequestTimeline
- java.lang.Object
-
- com.microsoft.azure.cosmosdb.internal.RequestTimeline
-
- All Implemented Interfaces:
Iterable<RequestTimeline.Event>
public final class RequestTimeline extends Object implements Iterable<RequestTimeline.Event>
Represents the time and duration of important events in the lifetime of a request.A
ARequestTimelinerepresents a timeline as a sequence ofRequestTimeline.Eventinstances with name, time, and duration properties. Hence, one might use this class to represent any timeline.RequestTimelineserializes to JSON as an array ofRequestTimeline.Eventinstances. This is the default serialization for any class that implementsIterable.Example:
JSON serialization:OffsetDateTime startTime = OffsetDateTime.parse("2020-01-07T11:24:12.842749-08:00", DateTimeFormatter.ISO_OFFSET_DATE_TIME); sys.out.println(RequestTimeline.of( new RequestTimeline.Event("foo", startTime, startTime.plusSeconds(1)), new RequestTimeline.Event("bar", startTime.plusSeconds(1), startTime.plusSeconds(2))));[{"name":"foo","time":"2020-01-07T11:24:12.842749-08:00","duration":"PT1S"},{"name":"bar","time":"2020-01-07T11:24:13.842749-08:00","duration":"PT1S"}])
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRequestTimeline.Event
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
empty
public static RequestTimeline empty()
Returns an emptyRequestTimeline. The empty time line returned is static.- Returns:
- an empty
RequestTimeline.
-
iterator
public Iterator<RequestTimeline.Event> iterator()
Returns an iterator for enumerating theRequestTimeline.Eventinstances in thisRequestTimeline.- Specified by:
iteratorin interfaceIterable<RequestTimeline.Event>- Returns:
- an iterator for enumerating the
RequestTimeline.Eventinstances in thisRequestTimeline.
-
of
public static RequestTimeline of()
Returns an emptyRequestTimeline. The empty time line returned is static and equivalent to callingempty().- Returns:
- an empty request timeline.
-
of
public static RequestTimeline of(RequestTimeline.Event event)
Returns a newRequestTimelinewith a single event.- Returns:
- a new
RequestTimelinewith a single event.
-
of
public static RequestTimeline of(RequestTimeline.Event e1, RequestTimeline.Event e2)
Returns a newRequestTimelinewith a pair of events.- Returns:
- a new
RequestTimelinewith a pair of events.
-
of
public static RequestTimeline of(RequestTimeline.Event e1, RequestTimeline.Event e2, RequestTimeline.Event e3)
Returns a newRequestTimelinewith three events.- Returns:
- a new
RequestTimelinewith three events.
-
of
public static RequestTimeline of(RequestTimeline.Event e1, RequestTimeline.Event e2, RequestTimeline.Event e3, RequestTimeline.Event e4)
Returns a newRequestTimelinewith four events.- Returns:
- a new
RequestTimelinewith four events.
-
of
public static RequestTimeline of(RequestTimeline.Event e1, RequestTimeline.Event e2, RequestTimeline.Event e3, RequestTimeline.Event e4, RequestTimeline.Event e5)
Returns a newRequestTimelinewith five events.- Returns:
- a new
RequestTimelinewith five events.
-
of
public static RequestTimeline of(RequestTimeline.Event... events)
Returns a newRequestTimelinewith an arbitrary number of events.- Returns:
- a new
RequestTimelinewith an arbitrary number of events.
-
toString
public String toString()
Returns a textual representation of thisRequestTimeline.The textual representation returned is a string of the form
RequestTimeline(<event-array>).
-
-