Class 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 about PTransforms that make up a pipeline.

    Components specify their display data by implementing the HasDisplayData interface.

    See Also:
    Serialized Form
    • Method Detail

      • inferType

        public static @Nullable DisplayData.Type inferType​(@Nullable java.lang.Object value)
        Infer the 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));
           }
         }
         
        Returns:
        The inferred DisplayData.Type, or null if the type cannot be inferred,
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(@Nullable java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.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<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 as item(String, String) or item(String, Integer).
        Throws:
        java.lang.ClassCastException - if the value cannot be formatted as the given type.
        See Also:
        inferType(Object)