Class DisplayData
- java.lang.Object
-
- org.apache.beam.sdk.transforms.display.DisplayData
-
- All Implemented Interfaces:
java.io.Serializable
public class DisplayData extends java.lang.Object implements java.io.Serializable
Static display data associated with a pipeline component. Display data is useful for pipeline runner UIs and diagnostic dashboards to display details aboutPTransforms
that make up a pipeline.Components specify their display data by implementing the
HasDisplayData
interface.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
DisplayData.Builder
Utility to build up display data from a component and its included subcomponents.static class
DisplayData.Identifier
Unique identifier for a display data item within a component.static class
DisplayData.Item
Items
are the unit of display data.static class
DisplayData.ItemSpec<T>
Specifies anDisplayData.Item
to register as display data.static class
DisplayData.Path
Structured path of registered display data within a component hierarchy.static class
DisplayData.Type
Display data type.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<DisplayData.Identifier,DisplayData.Item>
asMap()
boolean
equals(@Nullable java.lang.Object obj)
static DisplayData
from(HasDisplayData component)
Collect theDisplayData
from a component.int
hashCode()
static @Nullable DisplayData.Type
inferType(@Nullable java.lang.Object value)
Infer theDisplayData.Type
for the given object.static DisplayData.ItemSpec<java.lang.Boolean>
item(java.lang.String key, @Nullable java.lang.Boolean value)
Create a display item for the specified key and boolean value.static <T> DisplayData.ItemSpec<java.lang.Class<T>>
item(java.lang.String key, @Nullable java.lang.Class<T> value)
Create a display item for the specified key and class value.static DisplayData.ItemSpec<java.lang.Double>
item(java.lang.String key, @Nullable java.lang.Double value)
Create a display item for the specified key and floating point value.static DisplayData.ItemSpec<java.lang.Float>
item(java.lang.String key, @Nullable java.lang.Float value)
Create a display item for the specified key and floating point value.static DisplayData.ItemSpec<java.lang.Integer>
item(java.lang.String key, @Nullable java.lang.Integer value)
Create a display item for the specified key and integer value.static DisplayData.ItemSpec<java.lang.Long>
item(java.lang.String key, @Nullable java.lang.Long value)
Create a display item for the specified key and integer value.static DisplayData.ItemSpec<java.lang.String>
item(java.lang.String key, @Nullable java.lang.String value)
Create a display item for the specified key and string value.static DisplayData.ItemSpec<?>
item(java.lang.String key, @Nullable ValueProvider<?> value)
Create a display item for the specified key andValueProvider
.static DisplayData.ItemSpec<org.joda.time.Duration>
item(java.lang.String key, @Nullable org.joda.time.Duration value)
Create a display item for the specified key and duration value.static DisplayData.ItemSpec<org.joda.time.Instant>
item(java.lang.String key, @Nullable org.joda.time.Instant value)
Create a display item for the specified key and timestamp value.static <T> DisplayData.ItemSpec<T>
item(java.lang.String key, DisplayData.Type type, @Nullable T value)
Create a display item for the specified key, type, and value.java.util.Collection<DisplayData.Item>
items()
static DisplayData
none()
Default emptyDisplayData
instance.java.lang.String
toString()
-
-
-
Method Detail
-
none
public static DisplayData none()
Default emptyDisplayData
instance.
-
from
public static DisplayData from(HasDisplayData component)
Collect theDisplayData
from a component. This will traverse all subcomponents specified viaDisplayData.Builder.include(java.lang.String, org.apache.beam.sdk.transforms.display.HasDisplayData)
in the given component. Data in this component will be in a namespace derived from the component.
-
inferType
public static @Nullable DisplayData.Type inferType(@Nullable java.lang.Object value)
Infer theDisplayData.Type
for the given object.Use this method if the type of metadata is not known at compile time. For example:
@Override public void populateDisplayData(DisplayData.Builder builder) { Optional<DisplayData.Type> type = DisplayData.inferType(foo); if (type.isPresent()) { builder.add(DisplayData.item("foo", type.get(), foo)); } }
- Returns:
- The inferred
DisplayData.Type
, or null if the type cannot be inferred,
-
items
public java.util.Collection<DisplayData.Item> items()
-
asMap
public java.util.Map<DisplayData.Identifier,DisplayData.Item> asMap()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(@Nullable java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
item
public static DisplayData.ItemSpec<java.lang.String> item(java.lang.String key, @Nullable java.lang.String value)
Create a display item for the specified key and string value.
-
item
public static DisplayData.ItemSpec<?> item(java.lang.String key, @Nullable ValueProvider<?> value)
Create a display item for the specified key andValueProvider
.
-
item
public static DisplayData.ItemSpec<java.lang.Integer> item(java.lang.String key, @Nullable java.lang.Integer value)
Create a display item for the specified key and integer value.
-
item
public static DisplayData.ItemSpec<java.lang.Long> item(java.lang.String key, @Nullable java.lang.Long value)
Create a display item for the specified key and integer value.
-
item
public static DisplayData.ItemSpec<java.lang.Float> item(java.lang.String key, @Nullable java.lang.Float value)
Create a display item for the specified key and floating point value.
-
item
public static DisplayData.ItemSpec<java.lang.Double> item(java.lang.String key, @Nullable java.lang.Double value)
Create a display item for the specified key and floating point value.
-
item
public static DisplayData.ItemSpec<java.lang.Boolean> item(java.lang.String key, @Nullable java.lang.Boolean value)
Create a display item for the specified key and boolean value.
-
item
public static DisplayData.ItemSpec<org.joda.time.Instant> item(java.lang.String key, @Nullable org.joda.time.Instant value)
Create a display item for the specified key and timestamp value.
-
item
public static DisplayData.ItemSpec<org.joda.time.Duration> item(java.lang.String key, @Nullable org.joda.time.Duration value)
Create a display item for the specified key and duration value.
-
item
public static <T> DisplayData.ItemSpec<java.lang.Class<T>> item(java.lang.String key, @Nullable java.lang.Class<T> value)
Create a display item for the specified key and class value.
-
item
public static <T> DisplayData.ItemSpec<T> item(java.lang.String key, DisplayData.Type type, @Nullable T value)
Create a display item for the specified key, type, and value. This method should be used if the type of the input value can only be determined at runtime. Otherwise,HasDisplayData
implementors should call one of the typed factory methods, such asitem(String, String)
oritem(String, Integer)
.- Throws:
java.lang.ClassCastException
- if the value cannot be formatted as the given type.- See Also:
inferType(Object)
-
-