public class DisplayData
extends java.lang.Object
implements java.io.Serializable
PTransforms
that
make up a pipeline.
Components specify their display data by implementing the HasDisplayData
interface.
Modifier and Type | Class and 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 an
DisplayData.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.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<DisplayData.Identifier,DisplayData.Item> |
asMap() |
boolean |
equals(@Nullable java.lang.Object obj) |
static DisplayData |
from(HasDisplayData component)
Collect the
DisplayData from a component. |
int |
hashCode() |
static @Nullable DisplayData.Type |
inferType(@Nullable java.lang.Object value)
Infer the
DisplayData.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 <T> DisplayData.ItemSpec<T> |
item(java.lang.String key,
DisplayData.Type type,
T value)
Create a display item for the specified key, type, and 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<Duration> |
item(java.lang.String key,
@Nullable Duration value)
Create a display item for the specified key and duration 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<Instant> |
item(java.lang.String key,
@Nullable Instant value)
Create a display item for the specified key and timestamp 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 and
ValueProvider . |
java.util.Collection<DisplayData.Item> |
items() |
static DisplayData |
none()
Default empty
DisplayData instance. |
java.lang.String |
toString() |
public static DisplayData none()
DisplayData
instance.public static DisplayData from(HasDisplayData component)
DisplayData
from a component. This will traverse all subcomponents
specified via DisplayData.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.public static @Nullable DisplayData.Type inferType(@Nullable java.lang.Object value)
DisplayData.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));
}
}
DisplayData.Type
, or null if the type cannot be inferred,public java.util.Collection<DisplayData.Item> items()
public java.util.Map<DisplayData.Identifier,DisplayData.Item> asMap()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(@Nullable java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static DisplayData.ItemSpec<java.lang.String> item(java.lang.String key, @Nullable java.lang.String value)
public static DisplayData.ItemSpec<?> item(java.lang.String key, @Nullable ValueProvider<?> value)
ValueProvider
.public static DisplayData.ItemSpec<java.lang.Integer> item(java.lang.String key, @Nullable java.lang.Integer value)
public static DisplayData.ItemSpec<java.lang.Long> item(java.lang.String key, @Nullable java.lang.Long value)
public static DisplayData.ItemSpec<java.lang.Float> item(java.lang.String key, @Nullable java.lang.Float value)
public static DisplayData.ItemSpec<java.lang.Double> item(java.lang.String key, @Nullable java.lang.Double value)
public static DisplayData.ItemSpec<java.lang.Boolean> item(java.lang.String key, @Nullable java.lang.Boolean value)
public static DisplayData.ItemSpec<Instant> item(java.lang.String key, @Nullable Instant value)
public static DisplayData.ItemSpec<Duration> item(java.lang.String key, @Nullable Duration value)
public static <T> DisplayData.ItemSpec<java.lang.Class<T>> item(java.lang.String key, @Nullable java.lang.Class<T> value)
public static <T> DisplayData.ItemSpec<T> item(java.lang.String key, DisplayData.Type type, T value)
HasDisplayData
implementors should call one of the typed factory methods, such as item(String,
String)
or item(String, Integer)
.java.lang.ClassCastException
- if the value cannot be formatted as the given type.inferType(Object)